--- ~/.bashrc ------

# 用于获取git分支名 
function parse_git_branch () { 
	git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' 
} 
GREEN="\[\033[0;32m\]" 
YELLOW="\[\033[0;33m\]" 
LIGHT_GRAY="\[\033[0;37m\]" 
NO_COLOR="\[\033[0m\]" 
# 配置你的目录显示 
PS1="$GREEN\w$NO_COLOR$YELLOW\$(parse_git_branch)$NO_COLOR\$ "

--- ~/.gitconfig ----

# 定义用户信息 
# 对应的命令: 
# git config --global user.email yss.nelson@gmail.com 
[user] 
	email = xxx@xxx.com
	name = xxx
# 缩写写法 
[alias] 
	st = status 
	di = diff 
	ci = commit 
	co = checkout 
	br = branch
	lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative

参考: http://ruby-china.org/topics/939