How do I alias commands in git?

I saw a screencast where someone had gotten

git st
git ci

to work. When I do it I get an error asking me if I meant something else.
Being a git newb, I need to know what you have to do to get this done?

25 s
25

Basically you just need to add lines to ~/.gitconfig

[alias]
    st = status
    ci = commit -v

Or you can use the git config alias command:

$ git config --global alias.st status 

On unix, use single quotes if the alias has a space:

$ git config --global alias.ci 'commit -v'

On windows, use double quotes if the alias has a space or a command line argument:

c:\dev> git config --global alias.ci "commit -v"

The alias command even accepts functions as parameters. Take a look at aliases.

Leave a Comment