Posts

Showing posts from May, 2018

Git branch information in your bash prompt

Image
I saw a post the other day by Barry McGillin about improving bash to include repository information - see here: http://barrymcgillin.blogspot.com.au/2018/04/making-git-cmd-line-fancy-ish.html . I had seen similar behaviour using zsh - specifically when I had tried out the oh-my-zsh project, but I always find my self turning back to bash. So, I started doing some searching on how to achieve this in bash to see what other options there were - and I found a few articles basically with the same solution as in the post I found. Then I came across the fact that Git provides a script that can be leveraged to accomplish the same. You can view the script hosted on GitHub: https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh The header of the script includes instructions on how to leverage this file, which in a nutshell is to place the script somewhere on your system, sourcing it within your .bashrc file, and updating your PS1 variable, again in bashrc, to reference __git_