Skip to content

Instantly share code, notes, and snippets.

@goedel-gang
Last active May 31, 2018 10:41
Show Gist options
  • Save goedel-gang/076c529bf7da8e0acd48a4120c23278d to your computer and use it in GitHub Desktop.
Save goedel-gang/076c529bf7da8e0acd48a4120c23278d to your computer and use it in GitHub Desktop.
Bash git prompt
# this is where it is on my system. Find a copy at
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh
source /usr/share/git/git-prompt.sh
# show if there are staged/unstaged changes
GIT_PS1_SHOWDIRTYSTATE=true
# pretty colours
GIT_PS1_SHOWCOLORHINTS=true
# show if there are untracked files
GIT_PS1_SHOWUNTRACKEDFILES=true
# sets prompt command. the two arguments are the string to appear before the git
# status, and the string to appear after it, using normal Bash prompt syntax.
PROMPT_COMMAND='__git_ps1 "\u|$(basename $(dirname "$PWD"))/$(basename "$PWD")" " "'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment