brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Create a ~/.gitexcludes file and paste in this:
.DS_Store
Add the following to your ~/.bashrc:
# Prompt customization
parse_git_branch() {
git=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')
trimmed=${git: 0: 30}
trimmed=${trimmed:-$git}
echo "$trimmed"
}
get_trimmed_path() {
path=$(echo $PWD | sed "s:$HOME:~:g")
trimmed=${path: -40}
trimmed=${trimmed:-$path}
echo $trimmed
}
export PS1="\[\033[96m\]\u:\[\033[1;33m\] \$(get_trimmed_path)\[\033[0;94m\]\$(parse_git_branch)\[\033[00m\] $ "
# Git (and other) autocompletion
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi