-
-
Save cbrunnkvist/b5c9beb10bcfacc17497094eabf0bcfa to your computer and use it in GitHub Desktop.
Bash git prompt and command completion with Xcode / Mac OS X >= Mavericks (no Homebrew required)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then | |
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash | |
fi | |
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh | |
# configuration variables as documented in: | |
# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh#L8 | |
# | |
GIT_PS1_SHOWDIRTYSTATE="yes" | |
# GIT_PS1_SHOWSTASHSTATE | |
GIT_PS1_SHOWUNTRACKEDFILES="yes" | |
GIT_PS1_SHOWUPSTREAM="auto" | |
GIT_PS1_SHOWCOLORHINTS="yes" | |
# GIT_PS1_STATESEPARATOR | |
# GIT_PS1_DESCRIBE_STYL | |
# GIT_PS1_HIDE_IF_PWD_IGNORED | |
export PROMPT_COMMAND='__git_ps1 "\u@\h:\W" "\\\$ ";' |
Thanks for the feedback! Yup, that is of course the correct thing to do in the name of portability.
And this is quite an old gist, I should probably update it to the equivalent for aaakshuly, I think this will work just fine with zsh
since that's been the default for years now already.zsh
too
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for sharing this. Consider using
xcode-select
rather than an explicit path to /Applications/Xcode.app. That will allow you to use the installed Xcode, regardless of whether it was renamed or if the app is installed in another folder.