Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 38 down vote accepted

When you open up your Git Bash, you should be by default in your home directory. Now create the .bashrc file (if on Win7 the file should be named .bashrc.). If you're not in the home directory change into it with:


You can create the file with:

touch .bashrc

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.

vim .bashrc

Change to Insert Mode by hitting the i key.

Add your alias:

alias gs='git status'

Exit the insert mode with ESC. And save-then-close your file with the following :wqEnter.

Finally source the file our open a new git bash.

source .bashrc

share|improve this answer
Thanks for your answer. I didn't know about .bashrc before, so your answer lead me to several sources, including…;, that agree that .bashrc is a better place to put aliases than .bash_profile. – Brian Jun 3 '13 at 15:07

You can put .bash_profile in your user directory: C:\Users\<username>.

You can also create some git-only aliases so you can do just git st for git status by adding these lines to C:\Users\<username>\.gitconfig:

st = status

Some other useful aliases:

cm = commit -m
cma = commit -a -m
br = branch
co = checkout
df = diff
ls = ls-files
sh = stash
sha = stash apply
shp = stash pop
shl = stash list
mg = merge
ph = push -u
share|improve this answer
If aliases for Git commands are needed, editing the .gitconfig file is usually sufficient. – Isxek Jun 2 '13 at 21:45
Thanks for your answer! I wasn't expecting to get two different but correct answers. – Brian Jun 3 '13 at 15:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.