-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
175 lines (145 loc) · 4.68 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
[alias]
st = status -sb
co = checkout
cob = checkout --no-track -b
cobr = !git checkout $(git branch | grep -v '*' | grep -v 'HEAD' | fzf)
copr = "!f() { git fetch origin pull/${1}/head:${2} && git co ${2}; }; f"
chp = cherry-pick
rb = rebase
rbm = rebase origin/master
rbi = rebase -i
rbiom = rebase -i origin/master
rbc = rebase --continue
c = commit
ca = commit --amend
can = commit --amend --no-edit
com = commit -m
coma = commit -a -m
aa = add --all
fa = fetch --all -p -v
f = fetch --all -p
fma = fetch origin master:master
fm = fetch origin main:main
r1 = reset HEAD~1
a = !git add $(git diff --name-only | fzf)
squash-all = "!f(){ git reset ${1} && git commit --amend --no-edit -a;};f"
# push
p = push
poh = push -u origin HEAD # like first push
pf = push --force-with-lease
# log section
lg = log --graph --oneline --abbrev-commit --color --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(dim black)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
lgs = log --oneline --no-merges --format=format:'- %s'
lga = !git lg --all
dlog = "!f() { : git log ; GIT_EXTERNAL_DIFF=difft git log -p --ext-diff $@; }; f"
# branch management
bdelete-force = !git branch --no-color | grep -v '*' | grep -v master | xargs --no-run-if-empty git branch -D
bdelete = !git branch --no-color --merged | grep -v '*' | grep -v master | xargs --no-run-if-empty git branch -d
bm = branch -m
recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"
branch-authors = for-each-ref --format='%(authorname) %09 %(if)%(HEAD)%(then)*%(else)%(refname:short)%(end) %09 %(creatordate)' refs/remotes/ --sort=authorname DESC
# alias management
aliases = "!git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\t=> \\2/' | sort"
# diff
d = diff
dc = diff --cached
dw = diff -w
dwc = diff -w --cached
dt = difftool
dtc = difftool --cached
dtw = difftool -w
dtwc = difftool -w --cached
# tags
tdelete = fetch --prune origin +refs/tags/*:refs/tags/*
last-tag = describe --abbrev=0 --tags
[user]
useconfigonly = true
[color]
ui = true
diff = true
[color "branch"]
current = blue
local = yellow
remote = green
[color "status"]
added = green
changed = yellow
untracked = red
[push]
default = current
followTags = false
[diff]
algorithm = histogram # see https://luppeng.wordpress.com/2020/10/10/when-to-use-each-of-the-git-diff-algorithms/
tool = difftastic
guitool = meld
#external = difft # Difftastic by default
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[diff "exif"]
textconv = exiftool
[pager]
difftool = true
[merge]
ff = false
conflictstyle = zdiff3
colorMoved = default
[core]
pager = delta
excludesfile = ~/.gitignore_global
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true # use n and N to move between diff sections
light = true # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
features = line-numbers
syntax-theme = GitHub
[pull]
ff = only
autoStash = true
[branch]
autosetuprebase = never
sort = committerdate
[rebase]
autoStash = true
autoSquash = true
instructionFormat = [%an @ %ar] %s
updateRefs = true # See https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/
[rerere]
enabled = true
autoupdate = true
[include]
path = ~/.gitconfig_private
[url "git@github.com:"]
insteadOf = gh:
[commit]
verbose = true
gpgsign = true
[fetch]
fsckobjects = true
[receive]
fsckobjects = true
[transfer]
fsckobjects = true
# To combat repository corruption!
# Note: this global option applies during receive and transmit
# https://git-scm.com/docs/git-config#git-config-transferfsckObjects
# via https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0
# via https://gist.github.com/scottnonnenberg/fefa3f65fdb3715d25882f3023b31c29
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[gpg]
program = gpg2
[init]
defaultBranch = main