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