Skip to content

Instantly share code, notes, and snippets.

@tomdwp
Last active February 8, 2018 20:07
Show Gist options
  • Save tomdwp/b1ae309fd95b52f837e44cb7bce8f202 to your computer and use it in GitHub Desktop.
Save tomdwp/b1ae309fd95b52f837e44cb7bce8f202 to your computer and use it in GitHub Desktop.
adding git information to bash prompt on macOS
## assuming you have git installed via Homebrew
## the prompt files needed are located here: /usr/local/etc/bash_completion.d/
## first, add this to your ~/.bash_profile
source /usr/local/etc/bash_completion.d/git-prompt.sh
# another ways is: source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
## if you also want git command completion, then add this too:
source /usr/local/etc/bash_completion.d/git-completion.bash
# another way is: source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWCOLORHINTS="yes"
#PROMPT_COMMAND='__git_ps1 "\u@\h:\w" "\\$ "'
PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
#PS1="\h:\W \u\$(__git_ps1 \" (%s) \")\$"
## I'm not entirely satisfied with this, but this is what I have so far...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment