→ git bash aliases

06 April 2008

My buddy Rob Sanheim recently post a fresh way to get a new Rails app up and running, git-style.

He shares some of his bash aliases at the bottom, so I thought I would do the same:

alias gb='git branch -a -v'
alias gs='git status'
alias gd='git diff'

# gc      => git checkout master
# gc bugs => git checkout bugs
function gc {
  if [ -z "$1" ]; then
    git checkout master
  else
    git checkout $1
  fi
}

Or grab the pastie.

Oh, bonus:

alias bashrc='vi ~/.bashrc && source ~/.bashrc'

Now you can type bashrc to edit the file and, when you’re done, it’ll automatically be loaded into your current shell. Essential.