Simple Git Aliases

Posted on May 2, 2012

1


I have been using Git for a while now and in that time, I have learned the value of using aliases.  Whenever I setup a new machine with git, adding my favorite aliases is first on my list.  I wanted to capture some of my favorite aliases here.  This will serve as not only a reference for myself, but hopefully helpful for others.

The following code snippet shows the alias portion of my ~/.gitconfig.  :

[alias]
 st = status -s
 br = branch
 pl = pull origin master
 rm = remote -v
 lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit --date=relative

Here are the commands you can run to add the aliases to your global config.

$> git config --global alias.st "status -s"
$> git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
$> git config --global alias.pl "pull origin master"
$> git config --global alias.rm "remote -v"

Here is a list of some other git aliases:

Tagged: