Skip to content

Instantly share code, notes, and snippets.

@BryanSchuetz
Created May 7, 2021 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BryanSchuetz/f59001a6969bd2e2cae2d63c35a9ec18 to your computer and use it in GitHub Desktop.
Save BryanSchuetz/f59001a6969bd2e2cae2d63c35a9ec18 to your computer and use it in GitHub Desktop.
Git branch in bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
NO_COLOR="\[\033[0m\]"
RED="\[\033[0;31m\]"
export PS1="⚑$RED\$(parse_git_branch) $NO_COLOR\w >"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment