-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.gitconfig
More file actions
171 lines (146 loc) · 4.96 KB
/
Copy path.gitconfig
File metadata and controls
171 lines (146 loc) · 4.96 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
# ~/.gitconfig
#
# global git configuration (set in each repo's .git/config to override these)
[user]
name = Corey Goldberg
email = 1113081+cgoldberg@users.noreply.github.com
useConfigOnly = true
[color]
branch = always
decorate = always
diff = always
grep = always
interactive = always
showbranch = always
status = always
ui = always
[core]
safecrlf = true
fsmonitor = true
untrackedcache = true
hooksPath = ~/.git-hooks
[pull]
rebase = true
[push]
default = simple
autoSetupRemote = true
[pager]
diff = delta
log = less
show = less
[rebase]
autoStash = true
[status]
showStash = true
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[alias]
b = branch
d = diff
s = stat # ~/bin/git-stat
co = checkout
df = diff --staged
clone-blobless = clone --filter=blob:none
clone-shallow = clone --depth=1
# commit logs
l = log --stat --pretty=fuller
lg = log -p --pretty=fuller
ll = log --graph --pretty=tformat:'%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
ls = log --pretty=tformat:'%C(auto,yellow)%h %C(auto,blue)%>(12,trunc)%ar %C(auto,magenta)%<(14,trunc)%aN %C(auto,green)%s%Creset'
# reset current branch to previous commit (preserve changes)
undo = reset --soft HEAD~1
# delete branch (even if not merged)
bd = branch -D
# list branches with ahead/behind + timestamp
br = branches # ~/bin/git-branches
# list git aliases
alias = "!git config --list | grep alias | cut -c 7- | tr -s ' ' | sort"
# open Github web page for default remote repository (requires GitHub CLI)
open = "!gh repo view --web >/dev/null 2>&1 &"
# sync remote with parent if in a fork, and rebase all local branches
up = "!git syncrepo && sleep 3; git sync; git branches"
# commit all staged/unstaged changes with inline message
ci = "!f() { git commit --all --message \"$*\"; }; f"
# perform normal repo maintenance and cleanup
# - preserves recently unreachable objects
tidy = "!f() { \
echo 'cleaning up repo...'; \
git fetch --all --prune --tags && \
git gc && \
git maintenance run; \
}; f"
# perform aggressive repo maintenance and cleanup
# - immediately expires reflogs and permanently prunes unreachable objects
tidy-aggressive = "!f() { \
echo 'aggressively cleaning up repo...'; \
git fetch --all --prune --tags && \
git reflog expire --expire=now --expire-unreachable=now --all && \
git gc --prune=now && \
git maintenance run; \
}; f"
# save a stash with a custom name
stash-save = "!f() { \
if [ -z \"$*\" ]; then \
echo \"Error: stash name required\" >&2; \
return 1; \
fi; \
git stash push -m \"$*\"; \
}; f"
# pop a stash by its name/message (uses first stash matching partial name)
stash-pop = "!f() { \
if [ -z \"$*\" ]; then \
echo \"Error: stash name required\" >&2; \
return 1; \
fi; \
ref=$(git stash list | grep -F \"$*\" | cut -d: -f1 | head -n1); \
if [ -n \"$ref\" ]; then \
git stash pop \"$ref\"; \
else \
echo \"Error: no matching stash found\" >&2; \
return 1; \
fi; \
}; f"
# delta pager: https://github.com/dandavison/delta
[delta]
features = custom-theme
# more themes: https://raw.githubusercontent.com/dandavison/delta/main/themes.gitconfig
[delta "custom-theme"]
blame-code-style = syntax
blame-format = "{author:<18} {commit:<6} {timestamp:<15}"
blame-palette = "#2E3440 #3B4252 #434C5E"
dark = true
file-added-label = [+]
file-copied-label = [==]
file-modified-label = [*]
file-removed-label = [-]
file-renamed-label = [->]
file-style = omit
hunk-header-decoration-style = "#5E81AC ul"
hunk-header-file-style = "blue ul bold"
hunk-header-line-number-style = "yellow box bold"
hunk-header-style = "file line-number bold"
line-numbers = true
line-numbers-left-style = "#5E81AC"
line-numbers-minus-style = brightred
line-numbers-plus-style = brightgreen
line-numbers-right-style = "#5E81AC"
line-numbers-zero-style = "#4C566A"
merge-conflict-begin-symbol = "<<<"
merge-conflict-end-symbol = ">>>"
merge-conflict-ours-diff-header-decoration-style = "#5E81AC box"
merge-conflict-ours-diff-header-style = "yellow bold"
merge-conflict-theirs-diff-header-decoration-style = "#5E81AC box"
merge-conflict-theirs-diff-header-style = "yellow bold"
minus-emph-style = "black red"
minus-style = brightred
plus-emph-style = "black green"
plus-style = brightgreen
syntax-theme = Nord
whitespace-error-style = "red reverse"
zero-style = syntax
# additional config for Windows
[includeIf "gitdir:C:/"]
path = ~/.gitconfig_win