My Git bash forgets my aliases. What can I do?

When you open the git bash type in the command touch .bash_profile. Following this type vim .bash_profile. You can then add your aliases to this file. Save the file and reopen the git bash and your aliases should work as expected.

This method allows you to create aliases for any bash command available in git bash however as others have answered it is also possible to create git specific aliases using git itself.


Instead of modifying your bash_profile you can setup a .gitconfig and add aliases like this:

[alias]
  st = status
  ci = commit
  br = branch
  co = checkout
  df = diff
  lg = log -p

Create the .bashrc file in the home directory:

touch ~/.bashrc
vim ~/.bashrc

In the file ~/.bashrc add the aliases:

alias gitc='git commit -a'
# -- ... and your other aliases here ...

Save the file (press <ESC>:wq in vim). Reload the file such that bash is aware of the changes made:

source ~/.bashrc

These steps work for me in Win 7/Win 8 with Git bash (MINGW32)