-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
218 lines (171 loc) · 5.17 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
[alias]
bclean = "!f() { git branch --merged ${1-main} | grep -v " ${1-main}$" | xargs -r git branch -d; }; f"
bdone = "!f() { git checkout ${1-main} && git up && git bclean ${1-main}; }; f"
c = commit -am
ci = commit -v
cia = commit --amend -va
cp = cherry-pick
cpc = cherry-pick --continue
cpa = cherry-pick --abort
cpq = cherry-pick --quit
ec = config --global -e
r = reset
rh = reset --hard
rt = remote -v
rad = remote add
rrm = remote rm
rpr = remote prune
rre = remote rename
rsu = remote set-url
br = branch -v
bD = branch -D
bM = branch -M
bra = branch -va
bru = branch -u
p = push
g = grep -p
b = blame -M -CC
h = help
cl = clone
s = status -sb
co = checkout
cob = checkout -b
cm = checkout main
re = rebase
ri = rebase -i
rim = rebase -i main
rc = rebase --continue
ra = rebase --abort
rs = rebase --skip
ss = stash save
sp = stash pop
sd = stash drop
sc = stash clear
sad = submodule add
df = diff --color --color-words --abbrev
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
l = log -p
sl = log --stat --format=oneline --abbrev-commit
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' -
squash = !sh -c 'git commit -m \"squash! $(git log -1 --format='\\''%s'\\'' $@)\"' -
ri = rebase --interactive --autosquash
who = !echo \"== Commits by Author:\\n`git shortlog -s -n`\\n\"
up = !sh -c 'git pull --rebase --prune $@ && git submodule update --init --recursive && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
f = fetch
fo = fetch origin
fa = fetch --all
conf = config --list
t = tag
td = tag -d
# Display the number of commits per author in numerical order
who = shortlog -sne --no-merges
today = !git log --since=midnight --author=\"$(git config user.name)\" --oneline
yesterday = !git log --since=\"2 day ago\" --until=midnight --author=\"$(git config user.name)\" --oneline
ls = ls-files
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
# File level ignoring
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
# snapshot stashes
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
# merging
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
# GitHub Pull Request Management
pr = "!f() { git fetch -fu origin refs/pull/$1/head:pr/$1; } ; f"
# Merge GitHub pull request on top of the `main` branch
mpr = "!f() { \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git rebase main pr/$1 && \
git checkout main && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \
fi \
}; f"
reauthor = !sh -c 'eval `git log --reverse --topo-order --pretty=format:\"git cherry-pick -m 1 %H && git commit --amend -C %H --author=\\\"%aN <%aE>\\\" && \" $0 ` "echo success" '
# Initialize git in a better way
# Adds .gitattributes, .gitignore and Readme.md file
ini = "!f() { git init && echo \"* text=auto\" >> .gitattributes && touch .gitignore README.md && git status; }; f"
switch = !legit switch \"$@\"
branches = !legit branches
sprout = !legit sprout \"$@\"
unpublish = !legit unpublish \"$@\"
harvest = !legit harvest \"$@\"
sync = !legit sync \"$@\"
publish = !legit publish \"$@\"
graft = !legit graft \"$@\"
[color]
ui = auto
[core]
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
filemode = false
autocrlf = false
ui = auto
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on OS X
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false
# Editor used for writing git commits
editor = nvim
[diff]
tool = vimdiff
submodule = log
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
log = true
tool = vimdiff
[rebase]
autosquash = true
autostash = true
[giggle]
main-window-maximized = true
main-window-geometry = 0x0+0+0
main-window-view = FileView
history-view-vpane-position = 547
file-view-vpane-position = 649
[remote "origin"]
receivepack = git receive-pack
[status]
short = true
branch = true
[log]
date = relative
mailmap = true
[grep]
lineNumber = true
[blame]
date = relative
blankboundary = true
showroot = true
[pull]
rebase = true
[push]
default = simple
[format]
signoff = true
coverLetter = auto
[user]
email = karambir@example.com
name = Karambir Example
[init]
defaultBranch = main