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