Add git prompt to Byodu (bash shell)

Chris Anderson/ March 25, 2014/ Uncategorized/ 0 comments

In order to make this work we need a bit a code that reads the git info from the project – this can be download using the following.

Rename the file after it is downloaded to  ~/  (~ is your home directory).

Now the profile needs to prompt profile needs to be modified from Byodu to use and add the git prompt.

Edit the following file – /usr/share/byobu/profiles/bashrc

At the top of the file just after the top comments add the following line

#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <>.
source ~/

# Ensure that we're in a tmux or screen session

Next we need to modify the PS1 prompt variable.  Below is a copy of my modified version with the change I made highlighted.  Look for this line afte rhte case statement.

case "$BYOBU_CHARMAP" in
    PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$prompt_status\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\033[33;34m\]\$(__git_ps1)\[\e[00m\]⟫ "

Hope that helps

Here are some other resources I found.


PS: I modified by .bashrc so this also works with a normal terminal – see the following code I used for that.

source ~/

if [ "$color_prompt" = yes ]; then
    #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[03;31m\]$(__git_ps1)\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
Share this Post

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