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
56 please = push --force-with-lease
57 diff = diff --word-diff
63 ai = add --interactive
65 f = "!git ls-files | grep -i"
70 amend = commit --amend
71 caa = commit -a --amend -C HEAD
72 fix = commit -a --fixup
73 ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
74 ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
75 lc = "!f() { git ll "$1"^.."$1"; }; f"
76 lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
79 lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
80 lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
84 dlc = diff --cached HEAD^
85 dr = "!f() { git diff -w "$1"^.."$1"; }; f"
86 diffr = "!f() { git diff "$1"^.."$1"; }; f"
90 rh1 = reset HEAD^ --hard
91 rh2 = reset HEAD^^ --hard
94 svnl = svn log --oneline --show-commit
98 assume = update-index --assume-unchanged
99 unassume = update-index --no-assume-unchanged
101 assumed = "!git ls-files -v | grep ^h | cut -c 3-"
102 # unassume all the assumed files
103 unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
104 assumeall = "!git status -s | awk {'print $2'} | xargs git assume"
106 sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
108 sbu = "!f() { git subtree pull --prefix $2 $1 master --squash; }; f"
110 lasttag = "describe --tags --abbrev=0"
111 lt = "describe --tags --abbrev=0"
114 taglog = "log --tags --simplify-by-decoration --pretty='format:%ci %d'"
117 ours = "!f() { git co --ours $@ && git add $@; }; f"
118 theirs = "!f() { git co --theirs $@ && git add $@; }; f"
121 rem="!git config -l | grep remote.*url | tail -n +2"
123 #apply patch from other local repo
124 lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f"
126 #open markdown files edited in last commit
127 last = "!gvim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)"
128 #open just created markdown in working directory
129 newmd = "!gvim $(git status -s | awk {'print $2'})"
131 # initial empty commit
132 empty = "!git commit -am\"[empty] Initial commit\" --allow-empty"
135 la = "!git config -l | grep alias | cut -c 7-"
136 # grep from root folder
137 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"
138 #rename branch tree to done-
139 done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
140 #add bitbucket remote
141 ra = "!f() { git remote add $1 https://bitbucket.org/$2.git; }; f"
143 # undo from here http://megakemp.com/2016/08/25/git-undo/
144 undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f"
145 serve = !git daemon --reuseaddr --verbose --base-path=. --export-all ./.git