DevelopingChris DevelopingChris - 7 months ago 48
Git Question

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?


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

    st = status
    ci = commit -v

Or you can use the git config alias command:

$ git config --global status 

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

$ git config --global 'commit -v'

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

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

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