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