stdfilt to access child process pid
[hband-tools.git] / dot-gitconfig
blobc4ca1b2234e1e8d03fc39e5653008707e5d353c3
1 [core]
2         pager = less $LESS -F
3         attributesfile = ~/.gitattributes
4         hooksPath = ~/bin/git-hook
6 [sendemail]
7         smtpserver = /usr/bin/env
8         smtpserveroption = sendmail
9         confirm = always
10         assume8bitEncoding = UTF-8
11         chainreplyto = false
12         annotate = yes
14 [merge]
15         ff = false
17 [gc]
18         reflogexpire = never
19         reflogexpireunreachable = never
21 [diff]
22         renames = copies
23         algorithm = patience
25 [diff "pdf"]
26         textconv = "fn(){ pdftotext -layout -nopgbrk \"$1\" -; }; fn"
27         cachetextconv = true
29 [diff "image"]
30         textconv = "fn(){ identify \"$1\"; exiftool -ALL \"$1\"; }; fn"
31         cachetextconv = true
33 [diff "json2"]
34         textconv = json2
35         cachetextconv = true
37 [diff "gunzip"]
38         textconv = gunzip -c
39         cachetextconv = true
41 [diff "unxz"]
42         textconv = unxz -c
43         cachetextconv = true
45 [diff "loffice"]
46         textconv = odt2txt
47         cachetextconv = true
49 [diff "soffice"]
50         textconv = soffice2html.pl
51         cachetextconv = true
53 [color]
54         ui = auto
55         status = auto
57 [color "diff"]
58         #plain =
59         meta = bold yellow
60         frag = magenta
61         func = bold white
62         #old =
63         #new =
64         #commit =
65         whitespace = normal white
67 [color "decorate"]
69 [color "log"]
70         
71 [color "branch"]
72         #current
73         #local
74         #remote
76 [alias]
77         # visual history info
78         graph = log --graph --format=format:'%C(magenta)%h%C(reset) %C(bold yellow)%an%C(reset) %C(bold green)%ar%C(reset)%C(red)%d%C(reset) <%ae> %C(cyan)%ai%C(reset)%n%w(0,8,8)%s%n' --all
79         graph-refs = log --simplify-by-decoration --graph --format=format:'%C(magenta)%h%C(reset)%C(red)%d%n%C(reset)%C(bold yellow)%an%C(reset) <%ae>%C(reset) %C(bold green)%ar %C(reset)%C(cyan)%ai%n' --all
80         
81     # operations with/on remotes
83         r = remote -v
84     new-remote-push-url = remote set-url --add --push
85         remote-branches = ls-remote --heads
86     delete-remote-ref = ! "fn(){ if [ -z \"$1\" ]; then echo \"Which branches/tags?\" >&2; return 1; fi; remote=$(git config --get-all \"branch.$1.remote\" | head -n1); [ -n \"$remote\" ] || remote=origin; git push \"$remote\" --delete \"$@\"; }; fn"
87         show-track = ! "fn(){ [ -n \"$1\" ] && b=$1 || b=$(git symbolic-ref --quiet --short HEAD); git config --get-all \"branch.$b.remote\"; git config --get-all \"branch.$b.merge\"; }; fn"
89     # changing branches/refs
91         master = checkout master
92         switch-to = checkout
93         back = ! "fn(){ git checkout $(git log -g --format=%gs | grep -m${1:-1} \"^checkout: moving from\" | tail -n1 | cut -d' ' -f4); }; fn"
94         prev = checkout HEAD~1
95         next = ! "fn(){ git checkout $(git rev-list --all --children | grep ^$(git show -s --format=%H) | cut -f2 -d' ' -s); }; fn"
96         co = checkout
97         timeback = ! "fn(){ commit=`git rev-list -n 1 --first-parent --before=\"$1\" HEAD --`; git checkout $commit; }; fn"
99     # creating refs
101         newbranch = checkout -b
102         newtree = checkout --orphan -b
103         # move a tag to the current HEAD
104         retag = ! "fn(){ git tag -d \"$1\" && git tag \"$1\"; }; fn"
105         
106     # digging around
108         search = ! "fn(){ git rev-list --all | GIT_PAGER='' xargs -L 32 git grep \"$@\" | less $LESS -F; }; fn"
109         search-commit = log -p --pickaxe-all -S
110         grep-commit = log -p --pickaxe-all -G
111         history = ! "cd \"$GIT_PREFIX\" && bash -c 'opts=(); while [ \"${1:0:1}\" = - ]; do opts+=(\"$1\"); shift; done; git log --follow --patch \"${opts[@]}\" -- \"$@\"' --"
112         tags = tag -l -n
113         
114         # get branch/ref info
115         
116         hash = show -s --format=%H
117         root = rev-parse --show-toplevel
118         b = for-each-ref --sort=committerdate refs/heads/ refs/remotes/ --format="\e[35m%(objectname:short=7)\e[0m%09\e[32m%(committerdate:relative)\e[0m%09%(if)%(HEAD)%(then)\e[1;33m*\e[0m\e[1m%(else)%20%(end)%(if:equals=refs/remotes)%(refname:rstrip=-2)%(then)\e[31m%(else)%(if:equals=refs/tags)%(refname:rstrip=-2)%(then)\e[36m%(else)\e[35m%(end)%(end)%(refname:lstrip=2)\e[0m%09\e[33m%(authorname)\e[0m%09%(contents:subject)\e[0m"
119         br = branch -v
120         unmerged-branches = branch -v --no-merged
121         
122         # get file/tree info
123         
124         ls = ls-files --cached
125         last-modified = log -1 --format=%ad --
127         # get stage info
129         st = status -s -b --untracked-files=normal
130         stt = status -s -b --untracked-files=no
131         status-tracked = status --untracked-files=no
132         conflicts = ! "fn(){ git diff --name-only --diff-filter=UXB | xargs -l sh -c 'f=$1; echo \"\\033[1;37;41m$f\\033[m\"; sed -ne \"/^<<<<<<</,/^>>>>>>>/p\" \"$f\" | sed -e \"s/^[<>=|]\\{7\\}.*/\e[1;33m&\e[m/\"' -- ; }; fn"
133         choose = ! "fn(){ local side=$1; shift; git checkout -m "$@"; git checkout --$side "$@"; git add "$@"; }; fn"
134         choose-theirs = choose theirs
135         choose-ours = choose ours
136         
137         sum = diff --stat --summary --find-copies --find-renames --ignore-all-space
138         sum-log = log --stat --summary --find-copies --find-renames
139         sum-stage = diff --stat --summary --find-copies --find-renames --ignore-all-space --staged
140         sum-commit = ! "fn(){ if [ -n \"$1\" ]; then REV=$1; shift; else REV=HEAD; fi; git diff --stat --summary --find-copies --find-renames \"$REV~1..$REV\" \"$@\"; }; fn"
141         sum-head = diff --stat --summary --find-copies --find-renames --ignore-all-space HEAD
142         
143         diff-stage = diff --staged --ignore-all-space
144         diff-commit = ! "fn(){ if [ -n \"$1\" ]; then REV=$1; shift; else REV=HEAD; fi; git show \"$REV~1..$REV\" --irreversible-delete --ignore-all-space \"$@\"; }; fn"
145         diff-head = diff --find-copies --find-renames HEAD
146         # --word-diff=color 
147         diff-last = ! "fn(){ git log -g --format=%h | { read h2; read h1; git diff "$@" $h1...$h2; }; }; fn"
148         diff-remote = ! "fn(){ git diff --find-copies --find-renames origin/$(git symbolic-ref --quiet --short HEAD); }; fn"
149         diff-to-branch = ! "fn(){ git diff --find-copies --find-renames $(git merge-base HEAD \"$1\"); }; fn"
150         diff-branch = ! "fn(){ b1=$1; shift; case \"$1\" in (-*|'') b2='';; (*) b2=$1; shift;; esac; git diff \"$@\" \"$(git common-ancestor \"$b1\" \"$b2\")\" \"$b1\"; }; fn"
151         branch-history = ! "parent_branch=master; fn(){ if [ $# = 0 ]; then b1=HEAD; else b1=$1; shift; case \"$1\" in (-*) b2='';; (*) b2=$1; shift;; esac; fi; if [ -z \"$b2\" ]; then b2=\"$(git common-ancestor \"$b1\" \"$parent_branch\")\"; fi; git log --patch --first-parent --no-merges \"$@\" \"$b2\"..\"$b1\"; }; fn"
152         which-branches-contain = branch --list --all --contains
153         which-tags-contain = tag -l --contains
155         common-ancestor = ! "fn(){ b1=$1 b2=$2 bash -c 'diff --old-line-format=\"\" --new-line-format=\"\" <(git rev-list --first-parent \"$b1\") <(git rev-list --first-parent \"${b2:-HEAD}\")' | head -n1; }; fn"
158         # stage manipulation
159         
160         update = ! "git add --update '/*' ; git st"
161         add-all = ! "fn(){ git add '/*' ; ec=$? ; git st ; return $ec; }; fn"
162         
163         remove-from-index = rm --cached --
164         drop-untracked-files = clean -dfx
165         unstage = ! "fn(){ git reset -q HEAD -- \"$@\"; git st; }; fn"
167         restore = checkout HEAD --
168         discard-all = checkout HEAD -- '*'
169         discard-unstaged = checkout -- '*'
170         
171         # commit
172         commit-tracked = ! "fn(){ git commit -a -m \"$*\"; }; fn"
173         ct = ! "git commit-tracked"
174         commit-stage = ! "fn(){ git commit -m \"$*\"; }; fn"
175         rephrase = commit --amend
176         
177         fixup = ! "hash=$(git show -s --format=%H); git commit -a -m \"fixup! $hash\"; EDITOR=true VISUAL=true git rebase --interactive --autosquash $hash^"
178         undo-commit = reset --soft HEAD~
179         edit-commit = ! "fn(){ subs=''; for com in \"$@\"; do hash=$(git show -s --format=%h \"$1\"); subs=\"$subs${subs:+; }s/^pick \\($hash\\)/edit \\1/\"; done; GIT_SEQUENCE_EDITOR=\"sed -i -e '$subs'\" git rebase --interactive $hash^; }; fn"
180         rebase-commit = ! "fn(){ git commit -m \"$(cat .git/rebase-merge/message)\" \"$@\"; }; fn"
181         
182         change-commits = ! "fn(){ if [ $# -lt 3 ]; then echo \"Arguments: <git-attribute-name> <old-value> <new-value> <ref..ref>\" >&2; return 1; fi; VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [ \\\"$`echo $VAR`\\\" = '$OLD' ]; then export $VAR='$NEW'; fi\" \"$@\"; }; fn"
183         # Example: git change-commits GIT_AUTHOR_EMAIL oldemail newemail HEAD~1..HEAD
184         #   git push origin +myBranch
185         
187         # commit info
188         
189         is-there-something-to-commit = ! "[ -n \"$(git status -s --porcelain --untracked-files=no)\" ]"
190         is-there-anything-to-commit = is-there-something-to-commit
191         commit-if-there-is-something = ! "fn(){ ! git is-there-something-to-commit || git commit-tracked "$@"; }; fn"
193         # merges
195         merge-theirs = merge -s recursive -X theirs
196         patch = cherry-pick --no-commit --edit -x
197         undelete = ! "fn(){ for f in \"$@\"; do f=${GIT_PREFIX}$f; git checkout $(git rev-list -n 1 HEAD -- \"$f\")^ -- \"$f\"; done; }; fn"
198         branch-off-patchset = ! "fn(){ set -e; base=\"$1\"; head=$(git show -s --format=%H); msgs=$(git log --pretty=format:%s \"$base..$head\"); git checkout -b patch-$(randstr 6 [0-9]) \"$base\"; git diff \"$base..$head\" | git apply --index; git commit -m \"$msgs\"; }; fn"
199         
200         # push
201         
202         current-branch-name = symbolic-ref --quiet --short HEAD
203         current-branch-tracking-remote = ! "fn(){ branch=$1; [ -n \"$branch\" ] || branch=$(git current-branch-name); git config --get \"branch.$branch.remote\"; }; fn"
204         push-branch = ! "fn(){ branch=$(git symbolic-ref --quiet --short HEAD); if [ -z \"$branch\" ]; then echo \"not on a branch\" >&2; return 1; fi; remote=$(git config --get \"branch.$branch.remote\"); git push \"${remote:-origin}\" \"$branch\"; }; fn"
205         push-all = ! "fn(){ git for remote in $(git remote); do echo \"+ git push $remote $*\" >&2; git push \"$remote\" \"$@\"; done; }; fn"
206         push-multi = ! "fn(){ for remote in \"$@\"; do echo git push $remote | colorize cyan; git push \"$remote\"; done; }; fn"
208         # stash
209         
210         preserve = stash save --no-keep-index --include-untracked
211         save = stash save --no-keep-index
212         save-unstaged = stash save --keep-index
213         unsave = ! "fn(){ ref=$(git stash list | grep -m1 \"$*\" | cut -f1 -d:); if [ -n \"$ref\" ]; then git stash show -p \"$ref\"; git stash apply \"$ref\"; else echo \"Can not find such a stashed commit with substring '$*'.\" >&2; git stash list >&2; return 1; fi; }; fn"
214         stash-list = stash list
215         slist = stash list
217         # other
218         
219         note = ! "fn(){ if [ -z \"$*\" ]; then git notes show; else git notes append -m \"$*\"; fi; }; fn"
220         notes-list = log --format=format:'%C(yellow)commit %H%C(reset) %C(red)%d%C(reset)%nDate: %C(cyan)%ai%C(reset) (%ar)%nAuthor: %C(bold yellow)%an%C(reset) <%ae>%nNote: %N%n%n%s%n'
221         bugs = bug bug
222         bug-users = bug user user
223         push-bugs = ! "fn(){ remote=${1:-$(git current-branch-tracking-remote)}; echo \"fetching bugs from '$remote' remote...\" >&2; git push  \"$remote\" --prune refs/bugs/* refs/identities/*; }; fn"
224         pull-bugs = ! "fn(){ remote=${1:-$(git current-branch-tracking-remote)}; echo \"fetching bugs from '$remote' remote...\" >&2; git fetch \"$remote\" \"refs/bugs/*:refs/bugs/*\" \"refs/identities/*:refs/identities/*\" && { [ ! -d .git/git-bug/cache/ ] || rm -r .git/git-bug/cache/; }; }; fn"