Skip to content

Instantly share code, notes, and snippets.

@kilmc
Created February 17, 2014 19:54
Show Gist options
  • Select an option

  • Save kilmc/9057771 to your computer and use it in GitHub Desktop.

Select an option

Save kilmc/9057771 to your computer and use it in GitHub Desktop.
# Branch Auto-completion
# Run the following curl command in Terminal anywehre and then copypaste the if statement
# into your .bash_profile usually found in ~/.bash_profile.
# curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Git branch in prompt
# Copypaste the following into your .bash_profile usually found in ~/.bash_profile.
# If the file doesn't exist do touch ~/.bash_profile first
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\W\[\033[32m\]\$(parse_git_branch)\[\033[00m\] $ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment