[Updates] A cool .bashrc addition to echo which git branch you are on

Andrew Stone andrew at stone.com
Wed Dec 11 20:41:55 EST 2013


Add this to .bashrc to see what git branch you are in:

-bash-3.2[feature/refactor]$ 

=======================

function parse_git_branch ()
{
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1]/"
}

if [[ "x$(whoami)" != xroot ]]; then
  PS1='\s-\v$(parse_git_branch)$ '
fi



Andrew Stone
Twitter / @twittelator
http://www.stone.com

          http://j.mp/twtl8rnu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cocoaconspiracy.com/pipermail/updates/attachments/20131211/3e96d1f1/attachment.html>


More information about the Updates mailing list