On Ubuntu 13+ and higher, /etc/bash_completion.d/git is now git-prompt

In this previous post I wrote about how to get some git branch information into your shell. That was written back when Ubuntu 12 LTS was the standard.

I recently upgraded a box to Ubuntu 16 LTS, and this information went away. 🙁

I discovered via trial and error, that the call that’s needed in .bashrc is now:

## To show you what branch you are in as you move around git repos
if [ -f /etc/bash_completion.d/git-prompt ]; then
. /etc/bash_completion.d/git-prompt
PS1='\[\u@\h \e[33m\]\w\[\e[0m\] $(__git_ps1 " (%s)")\n\$ '

/etc/bash_completion.d/git is now: /etc/bash_completion.d/git-prompt

Leave a Reply

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