Skip to content

Instantly share code, notes, and snippets.

@mehranhadidi
Created September 15, 2016 07:08
Show Gist options
  • Save mehranhadidi/4525a0ed3eb9bc1dc2c2fb5105347600 to your computer and use it in GitHub Desktop.
Save mehranhadidi/4525a0ed3eb9bc1dc2c2fb5105347600 to your computer and use it in GitHub Desktop.
# How to show current git branch name
# Add following lines to your ~/.bash_profile
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
# ----------------------------------------------------------------------------------------------
# how to colorfull git output
# add to this file ~/.gitconfig
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[color "interactive"]
added = yellow
changed = green
untracked = cyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment