Your prompt for the raspberry pi is set in the ~/.bashrc
file. This is the default:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
Changing to Add Git Branch
I wanted to change this to include which branch I was on for git as I was going to be building new versions of stockfish and possibly other software.
In the ~/.bashrc
file, add this block somewhere near the top. I put it before the block above.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
This function will figure out what branch you are on. If you aren’t in a git repository, nothing happens.
Then, change that first PS1
line to be
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[36m\]\$(parse_git_branch)\[\033[00m\] $ "