]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - gitconfig.in
gitconfig: diff: color functions in hunks blue
[config/dotfiles.git] / gitconfig.in
1 # Global Git configuration file.
2
3 # Copyright (C) 2011-2015  Simon Ruderich
4 #
5 # This file is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This file is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this file.  If not, see <http://www.gnu.org/licenses/>.
17
18
19 [user]
20         name = Simon Ruderich
21         email = simon@ruderich.org
22
23 [color]
24         ui = auto
25
26 [color "diff"]
27         # Meta information.
28         meta = yellow bold
29         # Hunk header.
30         frag = magenta bold
31         # Function in hunk header.
32         func = blue bold
33         # Removed lines.
34         old = red bold
35         # Added lines.
36         new = green bold
37         # Commit headers.
38         commit = cyan
39
40 # GNU grep-like colors.
41 [color "grep"]
42         filename = magenta
43         linenumber = green
44
45 [core]
46         editor = vim
47         # Global gitattributes file. Thanks to canton7 in #git on Freenode
48         # (2011-11-09 13:23 CET).
49         attributesfile = PWD/gitattributes
50
51 # Use pager for the following commands.
52 [pager]
53         status = yes
54         tag = yes
55
56 [interactive]
57         # Don't require <Return> in interactive commands which require only a
58         # single key, for example `git add --patch`. Requires Perl module
59         # Term::Readkey.
60         singlekey = yes
61
62 [alias]
63         ## Shortcuts for often used commands.
64         #
65         ## Local.
66         c   = commit --verbose
67         ca  = commit --verbose --amend
68         cad = commit --verbose --amend --date=
69         d   = diff
70         dw  = diff --color-words
71         dc  = diff --cached
72         dcw = diff --cached --color-words
73         ds  = diff --stat
74         g   = grep
75         s   = status
76         l   = log
77         ls  = log --stat
78         lp  = log --patch
79         lpw = log --patch --color-words
80         a   = add
81         ap  = add --patch
82         au  = add --update
83         ## Branches.
84         co  = checkout
85         b   = branch -a -v
86         m   = merge
87         mo  = merge origin/master
88         ## Remote.
89         f   = fetch
90         t   = tag
91         p   = push
92         # Parallel git remote update. Also strips unnecessary output.
93         ru = "! git remote \
94               | xargs -d '\\n' -n1 -P0 git remote update 2>&1 \
95               | sed '/^$/d; \
96                      /^Please make sure you have the correct access rights$/d; \
97                      /^and the repository exists\\.$/d;'"
98         # Push to all remotes. Thanks to albel727 in #git on Freenode
99         # (2011-06-04 16:06 CEST) for the idea. Modified to push in parallel
100         # and to strip unnecessary output.
101         rp = "! git remote \
102               | xargs -d '\\n' -n1 -P0 git push 2>&1 \
103               | sed '/^$/d; \
104                      /^Please make sure you have the correct access rights$/d; \
105                      /^and the repository exists\\.$/d;'"
106         ## Patches.
107         fp  = format-patch
108         ## Maintenance.
109         # (Redirection of stderr is necessary to prevent missing output with
110         # my "color stderr" solution in Zsh.)
111         fs  = ! git fsck --strict --full 2>&1
112         fg  = ! git fs && git gc --aggressive 2>&1 # fsck and compress repo
113         ## Misc.
114         sl  = stash list
115         ss  = stash save
116         ssk = stash save --keep-index
117         ssu = stash save --include-untracked
118         sa  = stash apply --index
119         sp  = stash pop --index
120
121         ## Custom commands.
122         #
123         # tig-like log view. Similar to the following but with author/date
124         # information. --pretty=format is not used because it doesn't allow
125         # precise enough control over formats and colors.
126         #
127         # tig = log --pretty=oneline --graph --all --decorate --abbrev-commit
128         tig = ! PWD/bin/tig.pl
129
130         # Create backup of uncommitted and untracked changes.
131         ssb = "! git stash save --include-untracked \
132                      \"Backup on $(LANG=C date '+%a, %d %b %Y %H:%M:%S %z')\" \
133                      >/dev/null \
134               && git stash apply >/dev/null"
135
136         # Display list and content of untracked files. Untracked directories
137         # and symbolic links are only listed.
138         u = "! git ls-files --other --exclude-standard --directory -z \
139              | xargs -0 sh -c '\
140                    for x; do \
141                        printf \"\\033[1;33m-> %s\\033[0m:\" \"$x\"; \
142                        if test -d \"$x\"; then \
143                            echo \" directory\"; \
144                        elif test -h \"$x\"; then \
145                            echo \" symbolic link\"; \
146                        else \
147                            echo; \
148                            cat \"$x\"; \
149                        fi; \
150                        echo; \
151                    done' argv0 \
152              | less"
153
154 [diff]
155         # Detect copies and renames.
156         renames = copy
157
158         # Diff algorithm to use.
159         algorithm = histogram
160
161         # Change the definition of a word as used by diff --color-words to be
162         # shorter (not only spaces) and thus simplify the generated diffs.
163         # Words ([a-zA-Z0-9_]+) are matched, or a single non-word character
164         # ([^a-zA-Z0-9_]), therefore changes to words are shown in complete
165         # (e.g. from "word" to "newword" as "[-word-]{+newword+}"), but
166         # changes to non-word characters are shown character wise (e.g. from
167         # "==" to "!=" as "[-=-]{+!+}="); [-..-] is removal, {+..+} is
168         # addition. See t/ for some tests and examples.
169         wordRegex = [a-zA-Z0-9_]+|[^a-zA-Z0-9_]
170
171 # Allow diffing of some binary files.
172 #
173 # "sh -c '..' -" is used when the programs require additional arguments. The
174 # last "-" is argv[0] which is passed to sh, the real arguments are passed
175 # after "-" by git.
176 [diff "gzip"]
177         textconv = gzip -d -c
178 [diff "pdf"]
179         textconv = sh -c 'exec pdftotext "$@" -' -
180 [diff "sqlite"]
181         textconv = sh -c 'exec sqlite3 "$@" .dump' -
182
183 [log]
184         # Display branches/tag names in log (same as log's --decorate option).
185         decorate = short
186
187 [merge]
188         tool = vimdiff
189
190         # Merge upstream branch if `git merge` is called without arguments.
191         defaultToUpstream = yes
192
193 [push]
194         # When running git push without a refspec push only the current
195         # branch, see man page git-config(1) for details.
196         default = simple
197
198 [format]
199         # When using git format-patch use threads and add all patches as
200         # replies to the first one.
201         thread = shallow
202
203 [transfer]
204         # Automatically fsck objects when receiving them (respected by git
205         # receive-pack and git fetch (>= 1.7.8, for fetch)).
206         fsckobjects = yes
207
208 # vim: ft=gitconfig