-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitconfig
More file actions
259 lines (223 loc) · 14.3 KB
/
Copy path.gitconfig
File metadata and controls
259 lines (223 loc) · 14.3 KB
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
[user]
name = Roland Pangu
email = faruzzy@gmail.com
[core]
; whitespace = trailing-space,space-before-tab,indent-with-non-tab
editor = nvim
quotepath = false
excludesfile = ~/.gitignore_global
autocrlf = input
pager = delta
[interactive]
diffFilter = delta --color-only
#attributesfile = ~/.gitattributes
[include]
path = ~/github/dotfiles/catppuccin.gitconfig
[delta]
side-by-side = true
navigate = true
light = false
features = catppuccin-mocha
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[alias]
# thanks to http://stackoverflow.com/questions/11269256/how-to-name-and-retrieve-a-stash-by-name-in-git
sshow = "!f() { git stash show stash^{/$*} -p; }; f"
sapply = "!f() { git stash apply stash^{/$*}; }; f"
checkpoint = "!f() { \
if [ -z \"$1\" ]; then \
echo \"Error: Please provide a checkpoint message\"; \
return 1; \
fi; \
if git stash list | head -n 1 | grep -q \"$1\"; then \
echo \"Updating existing checkpoint: $1\"; \
git stash drop stash@{0} && \
git stash push -m \"$1\" && \
git stash apply stash@{0}; \
else \
echo \"Creating new checkpoint: $1\"; \
git stash push -m \"$1\" && \
git stash apply stash@{0}; \
fi; \
}; f"
st = status -sb
c = commit
nc = commit --no-verify
all = commit -am
br = branch
co = checkout
df = diff --color --abbrev
dfc = diff --cached
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'
logr3 = log --stat -M -3
logit = log --stat -M
l = log --stat -C
lgl = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ls = ls-files
ign = ls-files -o -i --exclude-standard # Show files ignored by git
p = push
np = push --no-verify
shoot = push origin --delete
unstage = reset HEAD --
hardrs = reset --hard HEAD
prev = checkout -
discard = checkout --
rlc = !git reset --hard HEAD~1 # Remove last commit
ulc = reset --soft HEAD~1 # Undo last commit
update = "!f() { git fetch origin && git rebase origin/${1:-$(git rev-parse --abbrev-ref HEAD)}; }; f"
commend = commit --amend --no-edit
amend = !git add -u && git commit --amend --no-edit
amendall = !git add . && git commit --amend --no-edit
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Credit an author on the latest commit
credit = "!f() { \
if [ -n \"$1\" ] && [ -n \"$2\" ]; then \
git commit --amend --author \"$1 <$2>\" -C HEAD; \
fi \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# List remote branches
lrb = "!f() { \
remote="${1:-origin}"; \
git ls-remote --heads "$remote"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Merge GitHub pull request on top of the `master` 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 master pr/$1 && \
git checkout master && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nClose #$1\"; \
fi \
}; f"
lg = !" \
function git_log_graph() { \
set -eo pipefail; \
cd -- \"${GIT_PREFIX:-.}\"; \
git log --color=always --graph --abbrev-commit \
--format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) (GPG_%G?) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\" \"$@\" | \
sed -E \
-e 's/GPG_G/'\"$(printf '\\033[1;32mG\\033[0m')\"'/g' \
-e 's/GPG_B/'\"$(printf '\\033[1;41mB\\033[0m')\"'/g' \
-e 's/GPG_U/'\"$(printf '\\033[1;36mU\\033[0m')\"'/g' \
-e 's/GPG_X/'\"$(printf '\\033[1;31mX\\033[0m')\"'/g' \
-e 's/GPG_Y/'\"$(printf '\\033[1;31mY\\033[0m')\"'/g' \
-e 's/GPG_R/'\"$(printf '\\033[1;31mR\\033[0m')\"'/g' \
-e 's/GPG_E/'\"$(printf '\\033[1;35mE\\033[0m')\"'/g' \
-e 's/GPG_N/'\"$(printf '\\033[1;30mN\\033[0m')\"'/g' | \
less -F -S -R -M -i; \
}; \
git_log_graph \
"
fzf = !" \
function git_fzf() { \
set -o pipefail; \
cd -- \"${GIT_PREFIX:-.}\" || return 1; \
local -a args=( \"$@\" ); \
if [[ \"${#args[@]}\" -eq 0 ]]; then \
args+=( \"--graph\" --glob=\"refs/heads/*\" ); \
fi; \
local -a show_filter=(); \
local found_separator=0; \
for arg in \"$@\"; do \
if [[ \"$found_separator\" -eq 1 ]]; then \
show_filter+=(\"$arg\"); \
elif [[ \"$arg\" == \"--\" ]]; then \
found_separator=1; \
fi; \
done; \
local order_file=\"\"; \
if [[ \"${#show_filter[@]}\" -gt 0 ]]; then \
order_file=\"$(mktemp -t git_fzf_order.XXXX)\"; \
trap \"rm -f '$order_file'\" EXIT SIGINT SIGTERM; \
printf '%s\\n' \"${show_filter[@]}\" >\"$order_file\"; \
fi; \
export LESS='-R -S'; \
export BAT_PAGER='less -S -R -M -c -i'; \
export DELTA_PAGER='less -S -R -M -c -i'; \
local old_ripgrep_config=\"$RIPGREP_CONFIG_PATH\"; \
unset RIPGREP_CONFIG_PATH; \
git log --color=always --abbrev=7 --format=format:\"%C(bold blue)%h%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset) %C(white)%s%C(reset) %C(bold green)(%ar)%C(reset)\" \"${args[@]}\" | \
fzf --ansi --no-sort --layout=reverse --tiebreak=index \
--preview=\"H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); git show --color=always --format=fuller \\$H 2>/dev/null | delta --line-numbers --side-by-side --width \\${FZF_PREVIEW_COLUMNS:-80}\" \
--bind='ctrl-j:preview-down,ctrl-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,ctrl-d:preview-half-page-down,ctrl-u:preview-half-page-up' \
--bind=\"ctrl-m:execute(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); git show --color=always \\$H | delta --line-numbers --side-by-side --paging=always)\" \
--bind=\"alt-h:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); tmux display -d 3000 \\\"Branches: \\$(git branch --contains \\$H 2>/dev/null | sed 's/^[* ]\\\\+//' | paste -sd, -)\\\")\" \
--bind=\"alt-H:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); S=\\$(git show --format='%s' \\$H 2>/dev/null | head -1); tmux display -d 3000 \\\"Branches (Grep): \\$(git log --all --format='%H' -F --grep=\\\"\\$S\\\" 2>/dev/null | xargs -I{} git branch --contains {} 2>/dev/null | sed 's/^[* ]\\\\+//' | sort -u | paste -sd, -)\\\")\" \
--bind=\"alt-n:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); tmux display -d 3000 \\\"Tags: \\$(git tag --contains \\$H 2>/dev/null | paste -sd, -)\\\")\" \
--bind=\"alt-N:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); S=\\$(git show --format='%s' \\$H 2>/dev/null | head -1); tmux display -d 3000 \\\"Tags (Grep): \\$(git log --all --format='%H' -F --grep=\\\"\\$S\\\" 2>/dev/null | xargs -I{} git tag --contains {} 2>/dev/null | sort -u | paste -sd, -)\\\")\" \
--bind=\"ctrl-y:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); echo -n \\$H | pbcopy; tmux display -d 1000 \\\"Yanked: \\$H\\\")\" \
--bind=\"alt-y:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); F=\\$(git rev-parse \\$H 2>/dev/null); echo -n \\$F | pbcopy; tmux display -d 1000 \\\"Yanked: \\$F\\\")\" \
--bind=\"ctrl-s:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); S=\\$(git show --format='%s' \\$H 2>/dev/null | head -1); echo -n \\\"\\$S\\\" | pbcopy; tmux display -d 1000 \\\"Yanked: \\$S\\\")\" \
--bind=\"ctrl-o:execute-silent(H=\\$(echo {} | grep -oE '\\b[a-f0-9]{7,}\\b' | head -1); F=\\$(git rev-parse \\$H 2>/dev/null); gh browse \\$F 2>/dev/null && tmux display -d 1000 \\\"Opened: \\$F\\\")\" \
--preview-window='right:60%:wrap'; \
local fzf_exit=$?; \
[[ -n \"$old_ripgrep_config\" ]] && export RIPGREP_CONFIG_PATH=\"$old_ripgrep_config\"; \
return $fzf_exit; \
}; \
git_fzf \
"
[help]
autocorrect = 10
[color]
ui = auto
grep = auto
interactive = auto
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[fetch]
prune = true
[diff]
compactionHeuristic = true
algorithm = histogram
[color "branch"]
current = yellow reverse
local = yellow
remote = green
upstream = bold cyan
[color "status"]
# staged changes
added = yellow
updated = bold white green
# un-staged changes
changed = green
untracked = cyan
nobranch = bold red white
[merge]
log = true
conflictStyle = zdiff3
[github]
user = faruzzy
email = faruzzy@gmail.com
username = faruzzy
[mergetool]
keepBackup = true
# https://stackoverflow.com/questions/23918062/simple-vs-current-push-default-in-git-for-decentralized-workflow/23918418#23918418
[push]
default = simple
followTags = true
[web]
browser = open
[browser "ch"]
cmd = open -a \"/Applications/Google\\ Chrome.app\"
[pull]
rebase = true
[rerere]
enabled = true
[commit]
verbose = true
[branch]
sort = -committerdate
[init]
defaultBranch = main
[advice]
skippedCherryPicks = false