I'm using Git Bash on Windows 7 and would like to set up Bash profile aliases such as alias gs='git status'
to make my life easier. How can I do this?
Windows – How to modify the Git Bash profile in Windows
.bash-profilebashrcgit-bashwindows
.bash-profilebashrcgit-bashwindows
I'm using Git Bash on Windows 7 and would like to set up Bash profile aliases such as alias gs='git status'
to make my life easier. How can I do this?
Best Answer
When you open up your Git Bash, you should be in your home directory by default. Now create the .bashrc file (if on Windows 7 the file should be named .bashrc.).
If you're not in the home directory, change into it by typing:
and pressing Enter. cd, without any other parameters listed after, will always return the home directory.
You can create the file by typing:
Then edit it with Vim or you could try doing it with some Windows editor, but I don't recommend it, because of some text formatting issues.
Change to Insert Mode by hitting the i key.
Add your alias by typing:
Exit the insert mode by hitting the Esc key.
Save and close your file by typing the following :wqEnter.
:wEnter will only save your file.
:q!Enter will quit the editor without saving your file.
Finally, update the file to use your new changes by typing: