Skip to content

Instantly share code, notes, and snippets.

@abrahamsangha
Last active December 24, 2015 15:19
Show Gist options
  • Save abrahamsangha/6819829 to your computer and use it in GitHub Desktop.
Save abrahamsangha/6819829 to your computer and use it in GitHub Desktop.
Bash profile
export PATH="/usr/local/bin:$PATH"
export PGHOST=localhost
export GIT_PS1_SHOWDIRTYSTATE=true
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
parse_git_branch ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
gitver=$(git branch 2>/dev/null| sed -n '/^\*/s/^\* //p')
else
return 0
fi
echo -e $gitver
}
branch_color ()
{
if git rev-parse --git-dir >/dev/null 2>&1
then
color=""
if git diff --quiet 2>/dev/null >&2
then
color="${c_green}"
else
color=${c_red}
fi
else
return 0
fi
echo -ne $color
}
PS1='[\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]]\[${c_cyan}\]\W\[${c_sgr0}\]: '
alias ga='git add'
alias gps='git push'
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git commit -m'
alias gma='git commit -am'
alias gb='git branch'
alias gc='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpl='git pull'
alias gpr='git pull --rebase'
alias gcl='git clone'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment