]> ruderich.org/simon Gitweb - config/dotfiles.git/blob - gitconfig.m4
385166463fbae888093976962b2987521310a21b
[config/dotfiles.git] / gitconfig.m4
1 # Global Git configuration file.
2
3 # Copyright (C) 2011-2013  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 dnl Load m4 macros.
20 include(../lib.m4)
21
22 [user]
23         name = Simon Ruderich
24         email = simon@ruderich.org
25
26 [color]
27         ui = auto
28
29 [color "diff"]
30         # Meta information.
31         meta = yellow bold
32         # Hunk header.
33         frag = magenta bold
34         # Function in hunk header.
35         function = magenta bold
36         # Removed lines.
37         old = red bold
38         # Added lines.
39         new = green bold
40         # Commit headers.
41         commit = cyan
42
43 [core]
44         editor = vim
45         # Can't use ~/ because of older git versions.
46         excludesfile = GITIGNORE
47
48 # Use pager for the following commands.
49 [pager]
50         status = yes
51         tag = yes
52
53 [interactive]
54         # Don't require <Return> in interactive commands which require only a
55         # single key, for example `git add --patch`.
56         singlekey = yes
57
58 [alias]
59         ## Shortcuts for often used commands.
60         #
61         ## Local.
62         c   = commit --verbose
63         ci  = commit --verbose
64         d   = diff PATIENCE
65         di  = diff PATIENCE
66         dw  = diff PATIENCE --color-words
67         dc  = diff PATIENCE --cached
68         dcw = diff PATIENCE --cached --color-words
69         s   = status
70         st  = status
71         l   = log
72         ls  = log --stat
73         lp  = log --patch PATIENCE
74         a   = add
75         ap  = add --patch
76         au  = add --update
77         ## Branches.
78         co  = checkout
79         b   = branch -a -v
80         br  = branch -a -v
81         m   = merge
82         me  = merge
83         mo  = merge origin/master
84         ## Remote.
85         f   = fetch
86         fe  = fetch
87         t   = tag
88         p   = push
89         pu  = push
90         # Parallel git remote update. Also strips unnecessary output.
91         ru = "! git remote \
92               | xargs -d '\\n' -n1 -P0 git remote update 2>&1 \
93               | sed '/^$/d; \
94                      /^Please make sure you have the correct access rights$/d; \
95                      /^and the repository exists\\.$/d;'"
96         # Push to all remotes. Thanks to albel727 in #git on Freenode
97         # (2011-06-04 16:06 CEST) for the idea. Modified to push in parallel
98         # and to strip unnecessary output.
99         rp = "! git remote \
100               | xargs -d '\\n' -n1 -P0 git push 2>&1 \
101               | sed '/^$/d; \
102                      /^Please make sure you have the correct access rights$/d; \
103                      /^and the repository exists\\.$/d;'"
104         ## Patches.
105         fp  = format-patch
106         ## Maintenance.
107         # (Redirection of stderr is necessary to prevent missing output with
108         # my "color stderr" solution in Zsh.)
109         fs  = ! git fsck --strict --full 2>&1
110         fg  = ! git fs && git gc --aggressive 2>&1 # fsck and compress repo
111         ## Misc.
112         sl  = stash list
113         ss  = stash save
114         ssk = stash save --keep-index
115         sa  = stash apply
116         sp  = stash pop
117
118         ## Custom commands.
119         #
120         # tig-like log view. Similar to the following but with author/date
121         # information. --pretty=format is not used because it doesn't allow
122         # precise enough control over formats and colors.
123         #
124         # tig = log --pretty=oneline --graph --all --decorate --abbrev-commit
125         tig = ! TIG | less
126
127 [diff]
128         # Detect copies and renames.
129         renames = copy
130
131         # Change the definition of a word as used by diff --color-words to be
132         # shorter (not only spaces) and thus simplify the generated diffs.
133         # Words ([a-zA-Z0-9_]+) are matched, or a single non-word character
134         # ([^a-zA-Z0-9_]), therefore changes to words are shown in complete
135         # (e.g. from "word" to "newword" as "[-word-]{+newword+}"), but
136         # changes to non-word characters are shown character wise (e.g. from
137         # "==" to "!=" as "[-=-]{+!+}="); [-..-] is removal, {+..+} is
138         # addition. See t/ for some tests and examples.
139         wordregex = [a-zA-Z0-9_]+|[^a-zA-Z0-9_]
140
141 # Allow diffing of some binary files.
142 #
143 # `pdftotext-` is a wrapper around pdftotext which writes to stdout.
144 # `sqlite3dump` is a wrapper calling `sqlite3 database-file .dump`.
145 [diff "gzip"]
146         textconv = gzip -d -c
147 [diff "pdf"]
148         textconv = pdftotext-
149 [diff "sqlite"]
150         textconv = sqlite3dump
151
152 [merge]
153 IF(OS, darwin)
154         tool = opendiff
155 FI
156 IF(OS, debian)
157         tool = vimdiff
158 FI
159
160 [format]
161         # When using git format-patch use threads and add all patches as
162         # replies to the first one.
163         thread = shallow
164
165 [receive]
166         # Automatically fsck objects when receiving them (respected by git
167         # receive-pack and git fetch (>= 1.7.8, for fetch)).
168         fsckobjects = true
169
170 # vim: ft=gitconfig noet