git-aware ps1 Nov
19
1
0

http://blog.bitfluent.com/post/27983389/git-utilities-you-cant-live-without

You'll need git-completion.bash working, but put the following line into your .bashrc or .bash_profile to display the current branch in your terminal.

PS1='$(__git_ps1 "(%s)")$ '

Which you can combine with whatever you already have setup. It can be something similar to one of the following:

PS1='\h:\W$(__git_ps1 "(%s)") \u\$ '
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\ $(__git_ps1 "(%s)")$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] $(__git_ps1 "(%s)")$ '
Bookmark and Share
blog comments powered by Disqus