My Favorite Shell Aliases for Git

I’m a sucker for shortcuts and life hacks. I hate typing a lot of text at the command line. Here are my top bash/csh/zsh aliases for use with Git.

alias gs='git status'

This is my most common git command I’m running. So, of course, I’d like to keep it short and sweet.

alias gc='git add -A; git commit'

This one adds every changed and new file to the staging area and commits it. This one can be risky–it could add a file to your git index that you may not want to track, like a build artifact. Use this with care.

alias gf='git fetch --all; git fetch --tags'

When I fetch from the remote repo, I want tags too! With this alias I just type gf and I get all that taggy goodness.

alias gh='git log --oneline --abbrev-commit --all --graph --decorate'

To see a really nice git log, with commit hash, commit message, tag and branch this is a really handy alias.

Leave a Reply