Created
October 18, 2020 14:20
-
-
Save marek-panek/914be7666b9e3df994c89e7f5dc9140c to your computer and use it in GitHub Desktop.
Add current git branch name to bash prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Edit .bashrc file and and the following entries | |
parse_git_branch() { | |
git rev-parse --abbrev-ref HEAD 2> /dev/null | sed -e 's/^/(/' -e 's/$/) /' | |
} | |
if [ "$color_prompt" = yes ]; then | |
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \[\e[91m\]\$(parse_git_branch)\[\033[00m\]\$ " | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment