3 email = hendrik@securosys.ch
5 # push/pull/diff/options
13 autosetuprebase = always
35 diff = diff --word-diff
39 ai = add --interactive
41 f = "!git ls-files | grep -i"
47 amend = commit --amend
48 caa = commit -a --amend -C HEAD
51 ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
52 ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
53 lc = "!f() { git ll "$1"^.."$1"; }; f"
54 lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
62 dlc = diff --cached HEAD^
63 dr = "!f() { git diff -w "$1"^.."$1"; }; f"
64 diffr = "!f() { git diff "$1"^.."$1"; }; f"
70 rh1 = reset HEAD^ --hard
71 rh2 = reset HEAD^^ --hard
76 svnl = svn log --oneline --show-commit
84 assume = update-index --assume-unchanged
85 unassume = update-index --no-assume-unchanged
87 assumed = "!git ls-files -v | grep ^h | cut -c 3-"
88 # unassume all the assumed files
89 unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
90 assumeall = "!git status -s | awk {'print $2'} | xargs git assume"
94 sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
96 sbu = "!f() { git subtree pull --prefix $2 $1 master --squash; }; f"
100 lasttag = describe --tags --abbrev=0
101 lt = describe --tags --abbrev=0
104 ours = "!f() { git co --ours $@ && git add $@; }; f"
105 theirs = "!f() { git co --theirs $@ && git add $@; }; f"
108 rem="!git config -l | grep remote.*url | tail -n +2"
110 #apply patch from other local repo
111 lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f"
113 #open markdown files edited in last commit
114 last = "!gvim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)"
115 #open just created markdown in working directory
116 newmd = "!gvim $(git status -s | awk {'print $2'})"
118 # initial empty commit
119 empty = "!git commit -am\"[empty] Initial commit\" --allow-empty"
122 la = "!git config -l | grep alias | cut -c 7-"
124 # convoluted aliases {{{
125 # grep from root folder
126 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"
127 #rename branch tree to done-
128 done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
129 #add bitbucket remote
130 ra = "!f() { git remote add $1 https://bitbucket.org/$2.git; }; f"
134 # undo from here http://megakemp.com/2016/08/25/git-undo/
135 undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f"
138 serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git