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