What is current branch of working repository?
Our company use some git branching rules base on “Continuous Integration” approach that we plan to describe soon as separate topic.
But our current topic is about how to setup a bash to display current git branch of working repository.
It will clearly indicate which current git branch we use now and won’t allow us make mistakes with merge actions etc that sometime happen before this feature was configured
So first,lets put these two files from github to your home dir:
$sudo chmod +x .git-prompt.sh
$sudo chmod +x .git-completion.bash
Then edit your .bashrc file
And put to end of the file:
if [ -f ~/.git-completion.bash ]; then
export PS1='[\u@\h \W]$(__git_ps1 "(%s)")\$ '
Then when you will navigate to some git repository you will see something like
Originally posted at www.smart-gamma.com