3 email = gitcommit@henk.geekmail.org
6 # always make new branches rebase on their tracking branch
7 autosetuprebase = always
9 # use (i)ndex, (w)orktree, (c)ommit, etc instead of a/ and b/
11 # detect renames and copies
13 # use different color for moved code (default == zebra, currently)
16 # delete tracking references and info about remote branches
17 # does not delete any branches
20 # show linenumber (-n)
23 # only do fastforward merges
26 # push to branch with same name on remote
29 # rebase, don’t merge, local changes
31 # only accept fastforwards by default
34 # when in a dirty worktree, automatically create a stash before and apply after rebasing
36 # automatically squash marked commits (squash! …, fixup! …)
39 # don’t use rerere to resolve merge conflicts
45 ai = add --interactive
56 cpa = cherry-pick --abort
57 cpc = cherry-pick --continue
64 amend = commit --amend
65 caa = commit -a --amend -C HEAD
66 fix = commit -a --fixup
68 diff = diff --word-diff
71 dlc = diff --cached HEAD^
72 dr = "!f() { git diff -w "$1"^.."$1"; }; f"
73 diffr = "!f() { git diff "$1"^.."$1"; }; f"
78 ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date = relative
79 ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
80 lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
83 lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
84 lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
86 taglog = "log --tags --simplify-by-decoration --pretty='format:%ci %d'"
92 please = push --force-with-lease
98 rbc = rebase --continue
104 rh1 = reset HEAD^ --hard
105 rh2 = reset HEAD^^ --hard
115 f = "!git ls-files | grep -i"
116 lc = "!f() { git ll "$1"^.."$1"; }; f"
119 svnl = svn log --oneline --show-commit
120 assume = update-index --assume-unchanged
121 unassume = update-index --no-assume-unchanged
123 assumed = "!git ls-files -v | grep ^h | cut -c 3-"
124 # unassume all the assumed files
125 unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
126 assumeall = "!git status -s | awk {'print $2'} | xargs git assume"
128 sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
130 sbu = "!f() { git subtree pull --prefix $2 $1 master --squash; }; f"
132 lasttag = "describe --tags --abbrev=0"
133 lt = "describe --tags --abbrev=0"
136 ours = "!f() { git co --ours $@ && git add $@; }; f"
137 theirs = "!f() { git co --theirs $@ && git add $@; }; f"
140 rem="!git config -l | grep remote.*url | tail -n +2"
142 #apply patch from other local repo
143 lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f"
145 #open markdown files edited in last commit
146 last = "!gvim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)"
147 #open just created markdown in working directory
148 newmd = "!gvim $(git status -s | awk {'print $2'})"
150 # initial empty commit
151 empty = "!git commit -am\"[empty] Initial commit\" --allow-empty"
154 la = "!git config -l | grep alias | cut -c 7-"
155 # grep from root folder
156 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"
157 #rename branch tree to done-
158 done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
159 #add bitbucket remote
160 ra = "!f() { git remote add $1 https://bitbucket.org/$2.git; }; f"
162 # undo from here http://megakemp.com/2016/08/25/git-undo/
163 undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f"
164 serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git