Skip to content

Instantly share code, notes, and snippets.

@barbogast
Last active August 17, 2020 13:19
Show Gist options
  • Save barbogast/ef6cf62c48f8408af6f63eaeb6d1499c to your computer and use it in GitHub Desktop.
Save barbogast/ef6cf62c48f8408af6f63eaeb6d1499c to your computer and use it in GitHub Desktop.
# Get the Git branch
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Source: kirsle.net/wizards/ps1.html
export PS1="\[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment