Since I have to juggle between several projects on my typical day job, it would be nice if I can see which branch I am on in a git repository. I figured it out just a single line in my .bashrc:
local GIT='$(git branch &>/dev/null; if [ $? -eq 0 ]; then echo "($(git branch | grep '^*' |sed s/\*\ //))"; fi)'
Then add it to your prompt:
PS1="\u$....${GIT}${NONE}\$ "
Now I get:
~/Projects/spice-workspace/spice2(master)$ git checkout develop
~/Projects/spice-workspace/spice2(develop)$
Very cool!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment