Skip to content

Instantly share code, notes, and snippets.

@lijingjiang
Forked from redguardtoo/.gitconfig
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lijingjiang/e401027780e4745576dc to your computer and use it in GitHub Desktop.
Save lijingjiang/e401027780e4745576dc to your computer and use it in GitHub Desktop.
[apply]
whitespace = nowarn
[user]
name = Chen Bin
email =chenbin.sh@gmail.com
[core]
# @see http://comments.gmane.org/gmane.comp.version-control.git/166098
filemode = true
ignorecase = false
autocrlf = false
whitespace = cr-at-eol
editor = vim
pager = less -x1,5
[color]
diff = auto
status = auto
branch = auto
ui = auto
[alias]
a=add
ai= add -i
ap= add --patch # add hunk one by one
au = add -u
b = branch
br = branch -r #remote branches
bm = branch --merged
bn = branch --no-merged
c = commit
ca=commit --amend
cf=diff --name-only --diff-filter=U #conflicts
cl = clean -fxd
cn = cherry-pick --no-commit -x
co = checkout
cp = cherry-pick
ct=count-objects
d =diff
da= diff --name-only # get the file list
dc = diff --cached
dcs = diff --cached --stat
df= diff-tree --no-commit-id --name-only
# Remove branches that have already been merged with master
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# delete all remote branches except master and HEAD
dr = "!git branch -r | awk -F/ '/\\/[^mH]/{print $2}'| xargs -I{} git push origin :{}"
ds = diff --stat
w=diff --word-diff #highlight word changes
fc=fetch -p #fetch and clean local invalid ref
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code
fs = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
fp=format-patch -n --stdout
# Remove branches that have already been merged with master
l = log --pretty=format:'%C(yellow)%h%Creset%C(green)%d%Creset %ad %s %Cred(%an)%Creset' --date=short --decorate --graph
ls= log --pretty=format:'%h %s (%an)' --date=short # simple log for clipboard
# @see http://magazine.redhat.com/2008/05/02/shipping-quality-code-with-git/
lg = log --graph
lt = log --topo-order
mt= mergetool
# merge but not fast-forward
mn = merge --no-ff
m = merge
n = checkout -b
pr=pull --rebase
ps = push origin master
rh=reset --hard
rp=checkout -p
# revert the commit but apply change in index only
rn = revert --no-commit
rs=reset --soft
ra = rebase --abort
r = rebase
ri = rebase -i
rc = rebase --continue
rk = rebase --skip
rf = rev-parse --show-toplevel # show root folder
s= show
sb = show-branch
st = status -sb #short status output for geeks
su= status --untracked-files=no
t=stash
ta=stash apply
u = !git stash && git pull --rebase && git stash pop
# donot track the file(s)
ut=rm -r --cached
wc = whatchanged
# more meaningful alias for infrequent command
back=reset --soft HEAD^ # undo the previous commit
fetus = !git fetch && git branch -v -a
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
smtpuser = chenbin.sh@gmail.com
smtpserverport = 587
[github]
user = redguardtoo
[push]
default = tracking
[merge]
branchdesc = true
log = true
tool = vimdiff
[diff]
tool = vimdiff
[mergetool]
# no prompt before merge each file
prompt = false
[init]
templatedir = ~/.git_template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment