mandag den 21. oktober 2013

Installing git-completion.bash on Mac OS X

If your don't want to use MacPorts or similar then I recommend this approach.


mkdir -p ~/opt/git/completion
cd ~/opt/git/completion
curl -o ~/opt/git/completion/git-prompt.sh https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
curl -o ~/opt/git/completion/git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash


Insert this into ~/.bash_profile:

# Set git autocompletion and PS1 integration
if [ -f /Users/REPLACE-USERNAME-HERE/opt/git/completion/git-completion.bash ]; then
. /Users/REPLACE-USERNAME-HERE/opt/git/completion/git-completion.bash
fi

if [ -f /Users/REPLACE-USERNAME-HERE/opt/git/completion/git-prompt.sh ]; then
. /Users/REPLACE-USERNAME-HERE/opt/git/completion/git-prompt.sh
fi
GIT_PS1_SHOWDIRTYSTATE=true

PS1='\[\033[32m\]\u@\h:\W\[\033[00m\]:$(__git_ps1)\[\033[00m\]\$ '

Ingen kommentarer:

Send en kommentar

Bemærk! Kun medlemmer af denne blog kan sende kommentarer.