Skip to content

Instantly share code, notes, and snippets.

@andrewwatts
Created April 6, 2011 18:58
Show Gist options
  • Save andrewwatts/906277 to your computer and use it in GitHub Desktop.
Save andrewwatts/906277 to your computer and use it in GitHub Desktop.
script to add git-completion.bash to a bash shell
#!bash -x
mkdir -p $HOME/bin
pushd $HOME/bin
curl -fsSLO https://github.com/andrewwatts/dotfiles/raw/master/bin/git-completion.bash
popd
cat >> $HOME/.bashrc << EOF
# BEGIN git install from https://gist.github.com/gists/1536b5ada40498fbb768
test -r "$HOME/bin/git-completion.bash" && {
BLACK="\[\033[0;30m\]"
RED="\[\033[0;31m\]"
GREEN="\[\033[0;32m\]"
YELLOW="\[\033[0;33m\]"
BLUE="\[\033[0;34m\]"
MAGENTA="\[\033[0;35m\]"
CYAN="\[\033[0;36m\]"
WHITE="\[\033[0;37m\]"
RESET="\[\033[0m\]"
function __virtualenv_ps1 {
[ "\$VIRTUAL_ENV" ] && echo '('\$(basename \$VIRTUAL_ENV)') '
}
. $HOME/bin/git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=true
PS1="\n\${GREEN}\\\$(__virtualenv_ps1)\${RESET}\u@\h:\${CYAN}\W\${RESET} \${GREEN}\\\$(__git_ps1 '(git::%s)')\${RESET}\n$ "
}
EOF
. $HOME/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment