Skip to content

Instantly share code, notes, and snippets.

@moff
Created November 22, 2017 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moff/9daf44b8a6c6eb54258b9488944f06c0 to your computer and use it in GitHub Desktop.
Save moff/9daf44b8a6c6eb54258b9488944f06c0 to your computer and use it in GitHub Desktop.
Git branch in terminal (.bashrc
# Append current git branch in prompt
parse_git_branch() {
if ! git rev-parse --git-dir > /dev/null 2>&1; then
return 0
fi
git_branch=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
echo "[$git_branch]"
}
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;36m\]\u@\h\[\033[00m\]:\[\033[01;32m\]\w\[\033[00m\]\[\033[01;31m\]\$(parse_git_branch)\[\033[00m\]$ "
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment