Last active
December 17, 2015 17:28
-
-
Save rcrews/df18ac6d16aa8194649f to your computer and use it in GitHub Desktop.
Enable command completion for git commands. Also, if current directory is under git control, update prompt to show state. Good documentation is in the comments of the downloaded scripts.
This file contains hidden or 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
#!/bin/bash | |
# | |
# Enable command completion for git commands. Also, if current directory is | |
# under git control, update prompt to show state. Good documentation is in | |
# the comments of the downloaded scripts below. After running this script, | |
# source ~/.bash_profile to see the results: | |
# /bin/bash git-improvements.bash; source ~/.bash_profile | |
# | |
curl --create-dirs \ | |
'https://raw.githubusercontent.com/git/git/master/contrib/completion/{git-completion.bash}' \ | |
-o "${HOME}/.config/git/#1" \ | |
'https://raw.githubusercontent.com/git/git/master/contrib/completion/{git-prompt.sh}' \ | |
-o "${HOME}/.config/git/#1" | |
cat >> ${HOME}/.bash_profile << 'END'; | |
# If current directory is under git control, update prompt to show state. | |
# ----------+-------------------------+------------------------------- | |
# Symbols | Meaning | Variable | |
# ----------+-------------------------+------------------------------- | |
# * Unstaged files GIT_PS1_SHOWDIRTYSTATE=1 | |
# + Staged files " | |
# $ Stashed files GIT_PS1_SHOWSTASHSTATE=1 | |
# % Untracked files GIT_PS1_SHOWUNTRACKEDFILES=1 | |
# < Upstream is ahead GIT_PS1_SHOWUPSTREAM=auto | |
# > Upstream is behind " | |
# = Up to date " | |
# <> Diverged from upstream " | |
# ----------+-------------------------+------------------------------- | |
# Also, enable command completion for git commands. | |
# Good documentation is in the comments of the ~/.config/git scripts. | |
# | |
source ${HOME}/.config/git/git-prompt.sh | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWSTASHSTATE=1 | |
export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
export GIT_PS1_SHOWUPSTREAM=auto | |
export GIT_PS1_SHOWCOLORHINTS=1 | |
export PROMPT_COMMAND='__git_ps1 "\h:\W \u" "\\\$ "' | |
source ${HOME}/.config/git/git-completion.bash | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment