If you are often working with 'git status' and 'git checkout/branch' the following may a huge enhancement for you
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$TERM" != "dumb" ]; then | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
# For ls colors in Solarized theme | |
# https://github.com/seebi/dircolors-solarized/issues/10 | |
export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD | |
# source git completion | |
if [ -f /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash ]; then | |
. /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash | |
fi | |
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh | |
alias ls='ls -G' | |
else | |
eval "`dircolors -b`" | |
alias ls='ls --color=auto' | |
fi | |
function _git_prompt() { | |
local git_status="`git status -unormal 2>&1`" | |
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then | |
if [[ "$git_status" =~ nothing\ to\ commit ]]; then | |
local ansi=32 | |
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then | |
local ansi=34 | |
else | |
local ansi=33 | |
fi | |
echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]' | |
fi | |
} | |
function _prompt_command() { | |
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;38m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]`_git_prompt`\$ " | |
} | |
PROMPT_COMMAND=_prompt_command | |
fi |