Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

Git Aliases

There are a few Git commands that I type a lot. For instance, I pull and push quite often, however these commands are quite long and sometimes require branch name lookups and maybe even cut-n-pasting.

git pull origin CURRENT_BRANCH

git push origin CURRENT_BRANCH

As a result, I feel that these commands take too long.

So, for speed purposes, I have written these aliases to automate the commands above to make my life a little bit easier.

alias pull='git branch | grep ^\* | awk "{print \$2}" | xargs git pull origin'

alias push='git branch | grep ^\* | awk "{print \$2}" | xargs git push origin'

You can just cut-n-paste them to your .bashrc configuration file.

Additionally, I have these other aliases that also speed me along.

alias fe='git fetch --all -p'

alias g='gitk &'

alias gk='gitk --all &'

alias stat='git status'

I hope that these aliases help speed you up too.

by Phil for Humanity
on 02/21/2013

Related Articles
 » Git Diff
 » Git Changes
 » Git Tag