Skip to content

Instantly share code, notes, and snippets.

@ksylvan
Last active March 24, 2016 17:27
Show Gist options
  • Save ksylvan/40edde47602b9087d8c4 to your computer and use it in GitHub Desktop.
Save ksylvan/40edde47602b9087d8c4 to your computer and use it in GitHub Desktop.
bash completion for git for Mac OSX
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# brew install bash-completion git git-extras git-flow
# Then add the following snippet to your .bash_profile
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -d $(brew --prefix)/bin ]; then
PATH=$(brew --prefix)/bin:$PATH
fi
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\h:\W \u\$(parse_git_branch)\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment