Skip to content

Instantly share code, notes, and snippets.

@suya55
Last active April 4, 2018 09:47
Show Gist options
  • Save suya55/14c4fc25633bf8d3be9e to your computer and use it in GitHub Desktop.
Save suya55/14c4fc25633bf8d3be9e to your computer and use it in GitHub Desktop.
git config alias
[core]
autocrlf = input
editor = /usr/bin/vim
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[alias]
st = status
s = status -s
cl = clone
ci = commit
cm = commit -m
cma = commit -a -m
ca = commit --amend
amend = commit --amend
caa = commit -a --amend -C HEAD
filelog = log -u
fl = log -u
ai = add --interactive
dd= !sh -c 'git branch -D $1 && git push origin :$1' -
dr= !sh -c 'git push origin :$1' -
d = !sh -c 'git branch -D $1' -
co = checkout
br = branch
bra = branch -ra
le = log --oneline --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lc = "!f() { git ll "$1"^.."$1"; }; f"
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
la = "!git config -l | grep alias | cut -c 7-"
diff = diff --word-diff
dc = diff --cached
dl = "!git ll -1"
dlc = diff --cached HEAD^
#dr = "!f() { git diff "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
branch = branch -ra
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
ru = rebase -i @{u}
svnr = svn rebase
svnd = svn dcommit
svnl = svn log --oneline --show-commit
sl = stash list
sa = stash apply
ss = stash save
cp = cherry-pick
grep = grep -Ii
gr = grep -Ii
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
f = "!git ls-files | grep -i"
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
lasttag = describe --tags --abbrev=0
lt = describe --tags --abbrev=0
mnf = merge --no-ff
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
pr = pull --rebase
ffs = flow feature start
fff = flow feature finish
ffd = flow feature delete
ffp = flow feature publish
frs = flow release start
frf = flow release finish
frd = flow release delete
frp = flow release publish
fhs = flow hotfix start
fhf = flow hotfix finish
switch = !legit switch \"$@\"
branches = !legit branches
sprout = !legit sprout \"$@\"
unpublish = !legit unpublish \"$@\"
harvest = !legit harvest \"$@\"
sync = !legit sync \"$@\"
publish = !legit publish \"$@\"
graft = !legit graft \"$@\"
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[push]
default = simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment