Branchulator is a simple script that you can add to your PS1 to remind you what branch you’re in in git. It’s written in Ruby.
Add it to your PS1 environment variable in .profile (or whichever bash config you use) like this:
BR_DIR="/path/to/branchulator/helpers" export PS1="\[\$($BR_DIR/c.sh)\]\$($BR_DIR/b.sh)\[\$($BR_DIR/d.sh)\]"
So my PS1 looks like this:
BR_DIR="~/Development/branchulator/helpers" export PS1="\[\$($BR_DIR/c.sh)\]\$($BR_DIR/b.sh)\[\$($BR_DIR/d.sh)\]\h:\w> "
…And you get colorful output like this when you’re in a directory with a git repo:
git:masteri[+1] euclid:~/Development/branchulator>
The branch name will be red if there are merge conflicts, yellow if there are uncommitted changes and green if everything’s up to date. The number after the name of the branch is the number of commits ahead or behind the origin branch you are. It will be blank if there is no origin branch.
FWIW, this code probably sucks! Use it at your own risk, it be MIT licensed. All glory to the hyponotoad.