]> git.netwichtig.de Git - user/henk/vcsh/git.git/blob - .config/git/config
Add push, pull, fixup aliases; indent cleanup
[user/henk/vcsh/git.git] / .config / git / config
1 [user]
2     name = Hendrik Jäger
3     email = hendrik@securosys.ch
4
5 # push/pull/diff/options
6 [push]
7   default = current
8 [pull]
9   default = current
10   ff = only
11 [diff]
12   mnemonicprefix = true
13 [branch]
14   autosetuprebase = always
15 [apply]
16   whitespace = nowarn
17 [merge]
18   ff = only
19
20 [rerere]
21   enabled = false
22 [rebase]
23   autosquash = true
24
25 # alias {{{
26 [alias]
27 # basic {{{
28   pl = pull
29   ps = push
30   st = status -s
31   cl = clone
32   ci = commit
33   co = checkout
34   cob = checkout -b
35   br = branch
36   r = reset
37   cp = cherry-pick
38   gr = grep -Ii
39   please = push --force-with-lease
40 # }}}
41 # tweak defaults {{{
42   diff = diff --word-diff
43   branch = branch -ra
44   grep = grep -Ii
45   bra = branch -ra
46   ai = add --interactive
47   # grep on filename
48   f = "!git ls-files | grep -i"
49 # }}}
50 # commit {{{
51   cm = commit -m
52   cma = commit -a -m
53   cmv = commit -a -v
54   ca = commit --amend
55   amend = commit --amend
56   caa = commit -a --amend -C HEAD
57   fix = commit --fixup
58 # }}}
59 # log commands {{{
60   ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
61   ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
62   lc  = "!f() { git ll "$1"^.."$1"; }; f"
63   lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
64   fl = log -u
65   filelog = log -u
66   lg  = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
67   lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
68 # }}}
69 # diff {{{
70   d = diff --word-diff
71   dc = diff --cached
72   # diff last commit
73   dlc = diff --cached HEAD^
74   dr  = "!f() { git diff -w "$1"^.."$1"; }; f"
75   diffr  = "!f() { git diff "$1"^.."$1"; }; f"
76 # }}}
77 # reset commands {{{
78   r1 = reset HEAD^
79   r2 = reset HEAD^^
80   rh = reset --hard
81   rh1 = reset HEAD^ --hard
82   rh2 = reset HEAD^^ --hard
83 # }}}
84 # git svn {{{
85   svnr = svn rebase
86   svnd = svn dcommit
87   svnl = svn log --oneline --show-commit
88 # }}}
89 # stash {{{
90   sl = stash list
91   sa = stash apply
92   ss = stash save
93 # }}}
94 # assume aliases {{{
95   assume = update-index --assume-unchanged
96   unassume = update-index --no-assume-unchanged
97   # show assumed files
98   assumed = "!git ls-files -v | grep ^h | cut -c 3-"
99   # unassume all the assumed files
100   unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
101   assumeall = "!git status -s | awk {'print $2'} | xargs git assume"
102 # }}}
103 # subtree {{{
104   #   add
105   sba = "!f() { git subtree add --prefix $2 $1 master --squash; }; f"
106   #   update/pull
107   sbu = "!f() { git subtree pull --prefix $2 $1 master --squash; }; f"
108 # }}}
109 # various useful {{{
110   # last tag created
111   lasttag = "describe --tags --abbrev=0"
112   lt = "describe --tags --abbrev=0"
113
114   # tag logs
115   taglog = "log --tags --simplify-by-decoration --pretty='format:%ci %d'"
116
117   # conflict/merges
118   ours = "!f() { git co --ours $@ && git add $@; }; f"
119   theirs = "!f() { git co --theirs $@ && git add $@; }; f"
120
121   #list remotes
122   rem="!git config -l | grep remote.*url | tail -n +2"
123
124   #apply patch from other local repo
125   lap = "!f() { git --git-dir=$1 format-patch -k -1 --stdout $2 | git am -3 -k; }; f"
126
127   #open markdown files edited in last commit
128   last = "!gvim $(git show HEAD --format="" --name-only | grep -e .*md$ | xargs)"
129   #open just created markdown in working directory
130   newmd = "!gvim $(git status -s | awk {'print $2'})"
131
132   # initial empty commit
133   empty = "!git commit -am\"[empty] Initial commit\" --allow-empty"
134
135   # list all aliases
136   la = "!git config -l | grep alias | cut -c 7-"
137 # }}}
138 # convoluted aliases {{{
139   # grep from root folder
140   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"
141   #rename branch tree to done-
142   done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
143   #add bitbucket remote
144   ra = "!f() { git remote add $1 https://bitbucket.org/$2.git; }; f"
145 # }}}
146 # worktree list {{{
147   wl = worktree list
148   # undo from here http://megakemp.com/2016/08/25/git-undo/
149   undo = "!f() { git reset --hard $(git rev-parse --abbrev-ref HEAD)@{${1-1}}; }; f"
150 # }}}
151
152 serve = !git daemon --reuseaddr --verbose  --base-path=. --export-all ./.git