Skip to content

Instantly share code, notes, and snippets.

@danielocallaghan
Created June 9, 2011 00:10
Show Gist options
  • Save danielocallaghan/1015768 to your computer and use it in GitHub Desktop.
Save danielocallaghan/1015768 to your computer and use it in GitHub Desktop.
Git config
~/.bashrc
# GIT modifications
export CLICOLOR=1
export TERM=xterm-color
export LSCOLORS=fxfxcxdxbxegedabagacad
# Setting GIT prompt
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
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 -n $color
}
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
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[$(branch_color)\]$(parse_git_branch)\[${c_sgr0}\]\$ '
alias gs='git status .'
$ cat ~/.gitconfig
[alias]
st = status
ci = commit
lc = log ORIG_HEAD.. --stat --no-merges
undo=reset --hard
changes=diff --name-status -r
diffstat=diff --stat -r
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
last = cat-file commit HEAD
unstage = reset HEAD
[color]
ui = 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
[user]
name = Daniel O'Callaghan
email = DO'[email protected]
[apply]
whitespace = nowarn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment