Add Git Branch Name to Shell Prompt

PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @
\w\[\033[0;32m\]\n$(git branch 2>/dev/null | grep "^*" | colrm 1
2)\[\033[0;32m\]??\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '

Credit: https://gist.github.com/justintv/168835

 

 836 total views,  1 views today

about author

Ankan Basu

ankanbasu@ankanbasu.com

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.