-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
241 lines (241 loc) · 7.65 KB
/
.gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# -*- conf -*-
#
# .gitconfig - per-user Git setup
#
#ident "@(#)HOME:.gitconfig 37.11 24/09/25 15:02:48 (woods)"
#
# N.B.: user.* could be set in GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL and those
# should probably be set in ~/.localprofile, though Git is stupid and prefers
# the environment variables over the local settings in the ${REPO}/.git/config
# file. If global settings are not appropriate then this is the best
# alternative as this is a fallback since the repo config has higher precedence.
# On the other hand if you want to use my (this) ~/.gitconfig then these values
# can be overridden with the environment variables!
#
# This could be in an include file, but it's not secret!
#
# n.b.: see also the Emacs (melpa) git-identity package
#
[user]
name = Greg A. Woods
email = woods@robohack.ca
signingkey = 627B5F14C259C785
[gpg]
program = gpg2
#
# for Emacs Magit/forge
#
[github]
user = robohack
[gitlab]
user = robo-hack
[gitlab "gitlab.freedesktop.org/api/v4"]
user = robohack
[bitbucket]
user = woods-bitbucket.org@planix.ca
#
[include]
path = ~/.gitconfig-local
#
[core]
pager = "less -R"
#
[alias]
# this is what it should have been called!
annotate = blame
ann = blame
# this is what "git log" should probably do by default!
mylog = log --all --oneline --graph --decorate=full
# convert the date field from mymlog to ISO Week with:
# gawk -F\| '{gsub(/[-:]/, " ", $3); printf("%s %-20s %s %s\n", $1, $2, strftime("%Y-W%V", mktime($3)), $4);}'
# n.b.: uses %ai, not %aI, as the latter is only in more recent git
mymlog = log --all --date=local --abbrev-commit --pretty=tformat:'%h|%aE|%ai|%s' --decorate=full
#
myllog = log --all --date=local --abbrev-commit --pretty=tformat:'%h %aE %ai %s' --graph --decorate=full
#
find-commits-add-or-delete = log -p -S
find-commits-matching = log -p -G
#
what = remote show origin
which = remote -v
active-branch = symbolic-ref --short -q HEAD
#
ahead = !sh -c 'git log --pretty=oneline --abbrev-commit $(git rev-parse --abbrev-ref --symbolic-full-name @{u})..'
behind = !sh -c 'git log --pretty=oneline --abbrev-commit ..$(git rev-parse --abbrev-ref --symbolic-full-name @{u})'
#
commit-add-amend-HEAD = commit -a --amend -C HEAD
caa = commit -a --amend -C HEAD
# Amend the currently staged files to the last commit
amend = commit --amend --reuse-message=HEAD
unstage-all = reset HEAD
unstage-file = checkout --
intend2add = add -N
unadd = rm --cached
# First, in .gitattributes, you would assign the diff
# attribute for paths. E.g.:
# *.tex diff=tex
wdiff = diff --color-words
# after a 'git apply', un-apply those changes that originally
# came from the stash:
stash-unapply = !git stash show -p | git apply -R
# from: https://stackoverflow.com/a/4991675/816536
oldest-ancestor = !bash -c 'diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${1:-master}") <(git rev-list --first-parent "${2:-HEAD}") | head -1' -
[merge]
conflictstyle = diff3
#
# XXX this is the pre-2.0 default, but it apparently can cause some problems
# when working with a shared central repository, e.g. when others push to the
# same "shared" branch. The new default is "simple", but I don't think I ever
# had a problem with "matching" at Klervi; and "matching" should work better
# when pulling from a forked upstream repo and pushing to the fork (which should
# probably have a remote named after your github(e.g.) username.
#
[push]
default = matching
#
# We set rebase=false by default, so remote tracking branches can be ff-only,
# and then with autoSetupRebase the local tracking branches get rebase=true.
# (XXX this does make it a bit fiddly to set up a clone sometimes.)
#
# The theory is if you're following a project and keeping local changes, or
# making changes to be submitted upstream, then you want remote tracking
# branches to fast-forward only on pull, but to be rebased on your local branch
# when you pull from, e.g., "master". (And, i.e., you never want to commit to
# your local (tracking) "master" branch! Always make a "local" branch that
# tracks the local remote-tracking "master" branch.)
#
# XXX Maybe "merge.ff=false" and "pull.ff=only" would be good defaults as the
# latter overrides the former when pulling.
#
[pull]
rebase = false
[branch]
autoSetupRebase = local
#
# For "git up":
#
# N.B.: get it with "pip install git-up" (as root for all users) (NOT gitup!)
#
[git-up "fetch"]
all = true
#
# N.B.: rebasing from upstream only works well for shared central repository
# usage where you're actively working on, committing to, and pushing to, shared
# branches. For 3rd-party projects this just causes extra overhead, since
# 3rd-party branches should (must) always be fast-forwardable, but if you happen
# to have the upstream "master" checked out when doing git-up, git-up won't
# fast-forward the currently checked out branch (since v1.0.6 I think, and up to
# v2.0.2 at least). Too bad git-up doesn't yet have an override for
# fast-fowarding the current branch (maybe IFF it is a remote-tracking branch
# and it's tracking the ''upstream'' (i.e. "origin")). Possibly it should
# honour pull.ff=only and branch.BR.mergeOptions=--ff-only; but probably it
# should just use "git pull", which already honours all these flags and options
# itself.
#
# Git-2.39 or so says:
#
# stderr: 'fatal: --preserve-merges was replaced by --rebase-merges
#
[git-up "rebase"]
auto = false
arguments = --rebase-merges
#
# Git 1.7.10+ supports an include path, e.g. to hide secrets:
# (Expansion of '~' appeared in Git 1.7.10.2)
#
# If git can't open the target file, it silently ignores the error.
#
[include]
path = ~/.gitconfig.secrets
#
# copy the following lines into the .gitattributes file of your
# repository (to make its contents a property of the repository that
# can be shared) or copy them to the repo's .git/info/attributes file
# (to keep it private to just your local clone of the repository) [and
# of course remove the leading '#' character]:
#
#*.c diff=cpp
#*.h diff=cpp
#*.cpk diff=cpp
#*.html diff=html
#*.p diff=pascal
#*.py diff=python
#*.jpg binary
#*.png binary
#
#
# The basic colors accepted are normal, black, red, green, yellow, blue,
# magenta, cyan and white. The first color given is the foreground; the second
# is the background.
#
# The accepted attributes are bold, dim, ul, blink, reverse, italic, and strike
#
# Specific attributes may be turned off by prefixing them with no or no- (e.g.,
# noreverse, no-ul, etc).
#
# The following are apparently the "default" hard-coded colours.
# [from http://shallowsky.com/blog/programming/gitcolors.html]
#
# They are not good for white backgrounds. ("yellow bold" is evil!)
#
#[color "diff"]
# plain = normal
# meta = bold
# frag = cyan
# old = red
# new = green
# commit = yellow
# whitespace = normal red
#[color "branch"]
# current = green
# local = normal
# remote = red
# plain = normal
#[color "status"]
# header = normal
# added = red
# updated = green
# changed = red
# untracked = red
# nobranch = red
#[color "grep"]
# match = normal
#[color "interactive"]
# prompt = normal
# header = normal
# help = normal
# error = normal
#[color "decorate"]
# branch = ???
# remoteBranch = ???
# tag = ???
# stash = ???
# HEAD = ???
#
#[color]
# branch = auto
# decorate = auto
# diff = auto
# grep = auto
# interactive = auto
# pager = true
# showbranch = auto
# status = auto
# ui = auto
#
# the following for "light" backgrounds was originally
# from: https://phdru.name/Software/dotfiles/lib/config/git/light_bg
#
[color "decorate"]
# HEAD = cyan
remoteBranch = green bold
branch = green bold
tag = blue bold
[color "diff"]
commit = yellow
[color "status"]
added = blue
changed = red
nobranch = green
untracked = red bold
updated = magenta