Skip to content

Instantly share code, notes, and snippets.

@kessejones
Last active April 4, 2019 13:08
Show Gist options
  • Save kessejones/513f2d9f370fcc7974c35beddb38130e to your computer and use it in GitHub Desktop.
Save kessejones/513f2d9f370fcc7974c35beddb38130e to your computer and use it in GitHub Desktop.
Display git branch name on terminal
#...
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1="${debian_chroot:+($debian_chroot)}\[\e[1m\]\[\e[01;32m\]\u@\h\[\e[00m\]:\[\e[01;34m\]\w\[\e[00m\]\[\e[33m\]\$(parse_git_branch)\[\e[00m\]$ "
#...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment