This article is outdated. Please visit updated git aliases blog post.
After more intensive work with git I have defined my own set of aliases that helps me to interact with git every day. Some of them are borrowed from Google, Red Hat folks or others but most of them are my own work. Please note this will only work with Git 1.5+.
pu = pull pur = pull --rebase cam = commit -am ca = commit -a cm = commit -m ci = commit co = checkout br = branch -v st = status unstage = reset HEAD -- k = !gitk g = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative h = !git --no-pager log origin/master..HEAD --abbrev-commit --pretty=oneline pom = !sh -c 'git h && echo Ready to push? ENTER && read && git push origin master' - rem = !sh -c 'test "$#" = 1 && git h && git checkout master && git pull && git checkout \"$1\" && git rebase master && git checkout master && git merge \"$1\" && echo Done and ready to do: git pom && exit 0 || echo \"usage: git rem \" >&2 && exit 1' - find = !git ls-tree -r --name-only HEAD | grep --color $1 purm = !git pull --rebase && git pom v = !gvim $*
git pu; git pur; git ci; git ca; git co; git br
Standard shortcut set for pull, commit, checkout and branch. These are must-haves.
Git status. What an alias! I use it a lot. Got a bash alias gg for "clear && git st".
The "missing" git command, taken from the Pro Git book.
Okay this just calls gitk if I accidentally insert a space. It happens to the best of us ;-)
Fast log with nice color formatting. Sometimes better than the standard git log.
Fast overview of differences between master and my current branch. Time saver.
Push into origin/master but first show me the differences in short one-line format and allow me to confirm with a key.
A masterpiece. Credit goes to msuchy for the original idea which I slightly extended. This pulls and rebases master on top of a (topic) branch, then merges it into the master and gets ready for pushing. Workflow I use everyday.
Finds a filename in the git repository. Gives absolute location (from the git root).
Sometimes I need to do a "quickfix" directly in the master, then pull with rebase and push. All in one command.
My invention here. Sometimes I need to open a Vim with a particular filename but I already got filename with absolute path (from git root). No need to edit it - this command opens Vim in the root git directory.
You'd better share your aliases in the discussion bellow ... or else!