Skip to content

Instantly share code, notes, and snippets.

@happiness801
Created March 1, 2018 21:22
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 happiness801/d8f940ff19271b663a6c1e1c8039abdb to your computer and use it in GitHub Desktop.
Save happiness801/d8f940ff19271b663a6c1e1c8039abdb to your computer and use it in GitHub Desktop.
# Include Git Branch name in prompt if applicable
# See: https://martinfitzpatrick.name/article/add-git-branch-name-to-terminal-prompt-mac/
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
PS1="$PS1\$(parse_git_branch)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment