-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
222 lines (199 loc) · 5.72 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
[user]
name = Nathan
#name = Nathan13888
email = [email protected]
[include]
path = ~/.gitconfig.local
[alias]
st = status -sb -uall
status = status --show-stash
tags = tag -l --sort=version:refname # view all tags
credit = shortlog -sne
save = commit -a -m "Save"
mer = merge
mff = merge --ff-only
mnff = merge --no-ff
bra = branch -vv --all # view all branches in the current repository
brv = bra # remove duplicate
brd = branch -d
brrm = brd
brm = branch -m #<A> <B> rename branch from A to B
cob = checkout -b # create new branch and switch to it
remv = remote -vv
rema = remote add # add remote URL
remao = rema origin # add origin (remote) URL
remau = rema upstream # add upstream URL
rems = remote set-url # set remote URL
remso = rems origin # set origin URL
remsu = rems upstream # set upstream URL
smuir = submodule update --init --recursive
# add fetch command, good for large projects
undo = reset HEAD~1
undo2 = reset HEAD~2
undo3 = reset HEAD~3
rmc = rm --cached # remove from VCS
us = reset -- # "unstage"; git reset [commit(def=HEAD)] -- <path>
rs = restore --staged
r = restore
ci = check-ignore
resethard = reset --hard
squash-all = "!f(){ git reset $(git commit-tree HEAD^{tree} \"$@\");};f"
renorm = add --renormalize .
brow = browse
pr="!f() { \
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD); \
git push -u origin $BRANCH_NAME; \
hub pull-request; \
};f "
v = version
mt = mergetool
lsf = ls-files
amend = commit --amend
ca = commit -S -s # sign commit and add comment
cam = ca -m
caa = ca -a # stage and commit everything
caam = caa -m
ash = stash
co = checkout
br = branch
di = diff
pl = pull
pu = push
pp = !git pull && git push
rem = remote
reb = rebase
fe = fetch
sm = submodule
a = add
aa = add . # stage everything to be committed
lg = log -p --pretty=fuller
ll = log --graph --pretty=format:'%C(auto)%h%d (%cr) %cn <%ce> %s'
# TODO: fix these
gr = log --graph --format=line # graph
grd = log --graph --format=detail # graph detail
gra = log --graph --format=line --all # graph all
grad = log --graph --format=detail --all # graph all in detail
showtool = ! "st() { if [ -z $1 ]; then c='HEAD'; else c=$1; fi; git difftool $c~..$c; }; st"
info = ! "inf() { if git rev-parse ${1} >/dev/null 2>&1; then git cat-file -p $(git rev-parse ${1}); else echo Invalid object; fi }; inf"
# commit-status: generate a commit with message from git-status (staged changes).
# Source: https://gist.github.com/erikw/654386d35ecfdb0354cd2b71763f19ae
cst = !" \
TMPFILE=$(mktemp /tmp/git-commit-status-message.XXX); \
git status --porcelain \
| grep '^[MARCDT]' \
| sort \
| sed -re 's/^([[:upper:]])[[:upper:]]?[[:space:]]+/\\1:\\n/' \
| awk '!x[$0]++' \
| sed -re 's/^([[:upper:]]:)$/\\n\\1/' \
| sed -re 's/^M:$/Modified: /' \
| sed -re 's/^A:$/Added: /' \
| sed -re 's/^R:$/Renamed: /' \
| sed -re 's/^C:$/Copied: /' \
| sed -re 's/^D:$/Deleted: /' \
| sed -re 's/^T:$/File Type Changed: /' \
| tr '\n' ' ' | xargs \
> $TMPFILE; \
cat $TMPFILE; \
commit=''; \
while :; do \
echo '> Commit with this message? [Yn]: '; \
read commit; \
([ -z \"$commit\" ] || [ \"$commit\" = y ] || [ \"$commit\" = Y ] || [ \"$commit\" = n ]) && break; \
done; \
test \"$commit\" != n || exit; \
git commit -F $TMPFILE; \
rm -f $TMPFILE \
"
[core]
editor = vim
filemode = true
ignorecase = true
autocrlf = input
[credential]
helper = store
#helper = /usr/lib/git-core/git-credential-libsecret
[commit]
template = ~/.gitmessage.txt
cleanup = strip
gpgSign = true
[diff]
renames = true
[push] # http://stackoverflow.com/a/23918418/89484
default = current
followTags = true
[merge]
tool = vimdiff
renameLimit = 0
ff = true # fast forward tip of current branch
renames = true
[fetch]
prune = true
[stash]
showPatch = true
[log]
date = relative
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[color]
branch = auto
diff = auto
interactive = auto
status = auto
ui = auto
[color "status"]
added = green
#updated = red
changed = cyan
untracked = magenta
nobranch = red white bold # not sure what this is...
[color "diff"]
plain = dim
meta = yellow
frag = magenta bold
func = cyan bold
old = red
new = green
commit = blue bold
whitespace = white reverse
[color "branch"]
current = green bold #reverse
local = red bold
remote = cyan bold
plain = magenta dim
[color "decorate"] # slots: branch, remoteBranch, tag, stash, HEAD (for git log --decorate)
[color "interactive"] # slots: prompt, header, help, error (for git add --interactive)
[help]
#autocorrect = 1 # basically instant, refer to git-config
[gpg]
program = gpg
[url "ssh://[email protected]:"]
insteadOf = "https://github.com"
pushInsteadOf = "https://github.com"
[url "[email protected]:"]
insteadOf = "gist:"
pushInsteadOf = "gist:"
[url "[email protected]:"]
insteadOf = "gl:"
pushInsteadOf = "gl:"
[url "https://[email protected]/"]
#[url "[email protected]:"]
insteadOf = "https://git.nathanchung.dev/"
pushInsteadOf = "https://git.nathanchung.dev/"
[url "[email protected]:"]
insteadOf = "https://git.csclub.uwaterloo.ca/"
pushInsteadOf = "https://git.csclub.uwaterloo.ca/"
[url "[email protected]:"]
insteadOf = "https://git.uwaterloo.ca/"
pushInsteadOf = "https://git.uwaterloo.ca/"
[rebase]
autosquash = true
[pull]
rebase = false
[init]
defaultBranch = master
#defaultBranch=$(git config --get init.defaultBranch || echo master)
[advice]
addIgnoredFile = false