Skip to content

Instantly share code, notes, and snippets.

@joshuaja
Created June 21, 2018 15:06
Show Gist options
  • Select an option

  • Save joshuaja/237f795cfc29fbd7d9fd5a1c04e0a2e5 to your computer and use it in GitHub Desktop.

Select an option

Save joshuaja/237f795cfc29fbd7d9fd5a1c04e0a2e5 to your computer and use it in GitHub Desktop.
.bashrc files to decorate prompt with current Git branch and commit status
# Rename file to .bashrc
# Fedora/RHEL
# from https://fedoraproject.org/wiki/Git_quick_reference
# Update prompt to show current Git branch and commit status
# (branch *) means tracked file is modified
# (branch +) means tracked file is modified and staged with 'git add'
# (branch %) means untracked files are in your tree
# Combinations of markers are possible
source /usr/share/git-core/contrib/completion/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
export PS1='[\u@\h \W$(declare -F __git_ps1 &>/dev/null && __git_ps1 " (%s)")]\$ '
# Rename file to .bashrc
# OS X
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
export PS1='[\u@\h \W$(declare -F __git_ps1 &>/dev/null && __git_ps1 " (%s)")]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment