... | ... |
@@ -260,6 +260,19 @@ |
260 | 260 |
| eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \ |
261 | 261 |
}; f" |
262 | 262 |
|
263 |
+ ; Filter meta. |
|
264 |
+ filter-meta = "!f() { : git filter-branch ; \ |
|
265 |
+ name=\"$1\"; shift; \ |
|
266 |
+ email=\"$1\"; shift; \ |
|
267 |
+ git filter-branch \"$@\" --env-filter \" \ |
|
268 |
+ GIT_AUTHOR_NAME=\\\"$name\\\"; \ |
|
269 |
+ GIT_AUTHOR_EMAIL=\\\"$email\\\"; \ |
|
270 |
+ GIT_COMMITTER_NAME=\\\"$name\\\"; \ |
|
271 |
+ GIT_COMMITTER_EMAIL=\\\"$email\\\"; \ |
|
272 |
+ GIT_COMMITTER_DATE=\\\"\\$GIT_AUTHOR_DATE\\\"; \ |
|
273 |
+ \" ; \ |
|
274 |
+ }; f" |
|
275 |
+ |
|
263 | 276 |
; Log. |
264 | 277 |
l = "!f() { : git log ; \ |
265 | 278 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -245,6 +245,21 @@ |
245 | 245 |
done; \ |
246 | 246 |
}; f" |
247 | 247 |
|
248 |
+ ; Refdiff. |
|
249 |
+ refdiff = "!f() { : git diff ; \ |
|
250 |
+ git config --get-colorbool color.diff && color_diff=always; \ |
|
251 |
+ git reflog --pretty='format:%h: %gs' \ |
|
252 |
+ | awk -F': ' '$2~/(commit|rebase).*\\((amend|finish)\\)/{print $1}' \ |
|
253 |
+ | while read -r ref; \ |
|
254 |
+ do \ |
|
255 |
+ git -c color.diff=$color_diff show --no-patch $ref; \ |
|
256 |
+ echo; \ |
|
257 |
+ git -c color.diff=$color_diff diff \"$@\" $ref HEAD; \ |
|
258 |
+ echo; \ |
|
259 |
+ done \ |
|
260 |
+ | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \ |
|
261 |
+ }; f" |
|
262 |
+ |
|
248 | 263 |
; Log. |
249 | 264 |
l = "!f() { : git log ; \ |
250 | 265 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -231,6 +231,20 @@ |
231 | 231 |
| sort -u; \ |
232 | 232 |
}; f" |
233 | 233 |
|
234 |
+ ; Browse. |
|
235 |
+ browse ="!f() { : ; \ |
|
236 |
+ set --; \ |
|
237 |
+ urls=\"$(git remote get-url ${@:-$(git remote)})\"; \ |
|
238 |
+ for url in $urls; \ |
|
239 |
+ do \ |
|
240 |
+ echo $url; \ |
|
241 |
+ { [ $(command -v xdg-open) ] && xdg-open \"$url\"; } || \ |
|
242 |
+ { [ $(command -v open) ] && open \"$url\"; } || \ |
|
243 |
+ { [ $(command -v start) ] && start \"$url\"; } || \ |
|
244 |
+ echo \"$@\"; \ |
|
245 |
+ done; \ |
|
246 |
+ }; f" |
|
247 |
+ |
|
234 | 248 |
; Log. |
235 | 249 |
l = "!f() { : git log ; \ |
236 | 250 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -224,6 +224,13 @@ |
224 | 224 |
git ls-files \"$@\" | tree -n ${color_tree+-C} --fromfile; \ |
225 | 225 |
}; f" |
226 | 226 |
|
227 |
+ ; Users. |
|
228 |
+ users = "!f() { : git log ; \ |
|
229 |
+ git log --pretty=full \"$@\" \ |
|
230 |
+ | sed -n 's/^\\(Author\\|Commit\\): \\(.*\\)/\\2/p' \ |
|
231 |
+ | sort -u; \ |
|
232 |
+ }; f" |
|
233 |
+ |
|
227 | 234 |
; Log. |
228 | 235 |
l = "!f() { : git log ; \ |
229 | 236 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -218,6 +218,12 @@ |
218 | 218 |
| eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \ |
219 | 219 |
}; f" |
220 | 220 |
|
221 |
+ ; Tree. |
|
222 |
+ tree = "!f() { : git ls-files ; \ |
|
223 |
+ git config --get-colorbool color.tree && color_tree=always; \ |
|
224 |
+ git ls-files \"$@\" | tree -n ${color_tree+-C} --fromfile; \ |
|
225 |
+ }; f" |
|
226 |
+ |
|
221 | 227 |
; Log. |
222 | 228 |
l = "!f() { : git log ; \ |
223 | 229 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -172,6 +172,52 @@ |
172 | 172 |
compactt = tformat:%C(BrightYellow)%h%x09%C(BrightMagenta)%>(1 )%ar%x09%C(BrightBlue)%<(1 )%aN%x09%C(BrightWhite)%s%C(auto)%d |
173 | 173 |
|
174 | 174 |
[alias] |
175 |
+ ; All. |
|
176 |
+ all = "!f() { : ; \ |
|
177 |
+ [ -t 1 ] && terminal=y; \ |
|
178 |
+ git config --get-colorbool color.all && color_all=always; \ |
|
179 |
+ git config --get-colorbool color.ui && color_ui=always; \ |
|
180 |
+ find . -type d -name '*.git' -prune \ |
|
181 |
+ | sed 's#^\\./\\.git$\\|^\\./\\|/\\.git$##g' \ |
|
182 |
+ | sort \ |
|
183 |
+ | awk '{ \ |
|
184 |
+ for (parent in parents) \ |
|
185 |
+ if ($0 ~ \"^\" parent) \ |
|
186 |
+ next; \ |
|
187 |
+ parents[$0]; \ |
|
188 |
+ print; \ |
|
189 |
+ }' \ |
|
190 |
+ | { \ |
|
191 |
+ if [ $# -eq 0 ]; \ |
|
192 |
+ then \ |
|
193 |
+ if [ $terminal ]; \ |
|
194 |
+ then \ |
|
195 |
+ tree -n ${color_all+-C} --fromfile; \ |
|
196 |
+ else \ |
|
197 |
+ cat; \ |
|
198 |
+ fi; \ |
|
199 |
+ else \ |
|
200 |
+ if [ $color_all ]; \ |
|
201 |
+ then \ |
|
202 |
+ get_color() { git -C \"$path\" config --get-color \"$@\"; }; \ |
|
203 |
+ color_reset=$(get_color '' reset); \ |
|
204 |
+ color_all_header=$(get_color color.all.header yellow); \ |
|
205 |
+ fi; \ |
|
206 |
+ while read -r path; \ |
|
207 |
+ do \ |
|
208 |
+ output=$(git -C \"$path\" -c color.ui=$color_ui \"$@\" 2>&1); \ |
|
209 |
+ [ \"$output\" ] || continue; \ |
|
210 |
+ printf '%s%s%s\\n%s\\n\\n' \ |
|
211 |
+ \"$color_all_header\" \ |
|
212 |
+ \"$path\" \ |
|
213 |
+ \"$color_reset\" \ |
|
214 |
+ \"$output\"; \ |
|
215 |
+ done; \ |
|
216 |
+ fi; \ |
|
217 |
+ } \ |
|
218 |
+ | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \ |
|
219 |
+ }; f" |
|
220 |
+ |
|
175 | 221 |
; Log. |
176 | 222 |
l = "!f() { : git log ; \ |
177 | 223 |
git config --get-colorbool color.diff && color_diff=always; \ |
... | ... |
@@ -167,12 +167,21 @@ |
167 | 167 |
maxStack = 100 |
168 | 168 |
|
169 | 169 |
[pretty] |
170 |
- patch = format:%C(BrightYellow)commit %h%C(auto)%d%n%C(BrightYellow)Author: %aN <%aE>%n%C(BrightYellow)Date: %ad%n%n%C(Yellow)%s%n |
|
171 |
- compact = tformat:%C(BrightYellow)%h %C(BrightMagenta)%>(13,trunc)%ar %C(BrightBlue)%<(15,trunc)%aN %C(BrightWhite)%s%C(auto)%d |
|
170 |
+ patch = format:%C(BrightYellow)commit %h%C(auto)%d%n%C(BrightYellow)Author: %aN <%aE>%n%C(BrightYellow)Date: %ad%n%n%C(Yellow)%s%n |
|
171 |
+ compact = tformat:%C(BrightYellow)%h%x20%C(BrightMagenta)%>(13,trunc)%ar%x20%C(BrightBlue)%<(15,trunc)%aN%x20%C(BrightWhite)%s%C(auto)%d |
|
172 |
+ compactt = tformat:%C(BrightYellow)%h%x09%C(BrightMagenta)%>(1 )%ar%x09%C(BrightBlue)%<(1 )%aN%x09%C(BrightWhite)%s%C(auto)%d |
|
172 | 173 |
|
173 | 174 |
[alias] |
174 | 175 |
; Log. |
175 |
- l = log --graph --pretty=compact |
|
176 |
+ l = "!f() { : git log ; \ |
|
177 |
+ git config --get-colorbool color.diff && color_diff=always; \ |
|
178 |
+ git -c color.diff=$color_diff log --graph --pretty=compactt \"$@\" \ |
|
179 |
+ | sed -E 's/^([^\\t]+\\t[^\\t,]+)(,.+)? ago(.*\\t.*)$/\\1\\3/' \ |
|
180 |
+ | sed -E 's/^(.*) +(.*[0-9a-f]{7}.*\\t)/\\1\\t\\2/' \ |
|
181 |
+ | sed -E 's/ *$//' \ |
|
182 |
+ | column -t -o ' ' -s \"$(printf '\\t')\" \ |
|
183 |
+ | eval \"LESS=${LESS-FRX} $(git var GIT_PAGER)\"; \ |
|
184 |
+ }; f" |
|
176 | 185 |
ls = log --oneline --decorate=no |
177 | 186 |
lf = log --first-parent |
178 | 187 |
lp = log --patch --pretty=patch |
... | ... |
@@ -165,3 +165,77 @@ |
165 | 165 |
[absorb] |
166 | 166 |
; https://github.com/tummychow/git-absorb |
167 | 167 |
maxStack = 100 |
168 |
+ |
|
169 |
+[pretty] |
|
170 |
+ patch = format:%C(BrightYellow)commit %h%C(auto)%d%n%C(BrightYellow)Author: %aN <%aE>%n%C(BrightYellow)Date: %ad%n%n%C(Yellow)%s%n |
|
171 |
+ compact = tformat:%C(BrightYellow)%h %C(BrightMagenta)%>(13,trunc)%ar %C(BrightBlue)%<(15,trunc)%aN %C(BrightWhite)%s%C(auto)%d |
|
172 |
+ |
|
173 |
+[alias] |
|
174 |
+ ; Log. |
|
175 |
+ l = log --graph --pretty=compact |
|
176 |
+ ls = log --oneline --decorate=no |
|
177 |
+ lf = log --first-parent |
|
178 |
+ lp = log --patch --pretty=patch |
|
179 |
+ lpw = lp --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
180 |
+ lpww = lp --color-words='.' |
|
181 |
+ la = l --all |
|
182 |
+ lsa = ls --all |
|
183 |
+ lfa = lf --all |
|
184 |
+ lpa = lp --all |
|
185 |
+ lpwa = lpw --all |
|
186 |
+ lpwwa = lpww --all |
|
187 |
+ |
|
188 |
+ ; Status. |
|
189 |
+ s = status |
|
190 |
+ ss = status --short |
|
191 |
+ sb = status --short --branch |
|
192 |
+ sa = s --ignored |
|
193 |
+ ssa = ss --ignored |
|
194 |
+ sba = sb --ignored |
|
195 |
+ |
|
196 |
+ ; Diff. |
|
197 |
+ d = diff |
|
198 |
+ du = diff @{upstream} |
|
199 |
+ dp = diff @{push} |
|
200 |
+ dc = d --cached |
|
201 |
+ duc = du --cached |
|
202 |
+ dpc = dp --cached |
|
203 |
+ dw = d --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
204 |
+ duw = du --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
205 |
+ dpw = dp --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
206 |
+ dcw = dc --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
207 |
+ ducw = duc --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
208 |
+ dpcw = dpc --color-words='[_[:alnum:]]+|[^[:space:]]' |
|
209 |
+ dww = d --color-words='.' |
|
210 |
+ duww = du --color-words='.' |
|
211 |
+ dpww = dp --color-words='.' |
|
212 |
+ dcww = dc --color-words='.' |
|
213 |
+ ducww = duc --color-words='.' |
|
214 |
+ dpcww = dpc --color-words='.' |
|
215 |
+ |
|
216 |
+ ; Add. |
|
217 |
+ au = add -u |
|
218 |
+ aa = add -A |
|
219 |
+ |
|
220 |
+ ; Commit. |
|
221 |
+ c = commit |
|
222 |
+ ca = commit --amend |
|
223 |
+ |
|
224 |
+ ; Rebase. |
|
225 |
+ ri = rebase -i |
|
226 |
+ ro = rebase -i --root |
|
227 |
+ rr = rebase --continue |
|
228 |
+ |
|
229 |
+ ; Fetch. |
|
230 |
+ f = fetch |
|
231 |
+ |
|
232 |
+ ; Push. |
|
233 |
+ p = push |
|
234 |
+ pf = push --force-with-lease |
|
235 |
+ |
|
236 |
+ ; Clean ignored files (requires either `-f`, `-i` or `-n`). |
|
237 |
+ x = clean -Xd |
|
238 |
+ |
|
239 |
+ ; Contains. |
|
240 |
+ contains = tag --contains |
|
241 |
+ ; contains = describe --contains |
... | ... |
@@ -104,3 +104,60 @@ |
104 | 104 |
|
105 | 105 |
[blame] |
106 | 106 |
date = relative |
107 |
+ |
|
108 |
+[log] |
|
109 |
+ graphColors = \ |
|
110 |
+ BrightRed, \ |
|
111 |
+ BrightGreen, \ |
|
112 |
+ BrightYellow, \ |
|
113 |
+ BrightBlue, \ |
|
114 |
+ BrightMagenta, \ |
|
115 |
+ BrightCyan |
|
116 |
+ |
|
117 |
+[diff] |
|
118 |
+ colorMoved = zebra |
|
119 |
+ colorMovedWS = ignore-space-change |
|
120 |
+ |
|
121 |
+[color "diff"] |
|
122 |
+ meta = BrightBlue |
|
123 |
+ frag = Blue |
|
124 |
+ func = Blue |
|
125 |
+ commit = BrightYellow |
|
126 |
+ whitespace = BrightRed |
|
127 |
+ plain = Yellow |
|
128 |
+ context = BrightWhite |
|
129 |
+ contextBold = BrightWhite |
|
130 |
+ contextDimmed = White |
|
131 |
+ old = BrightRed |
|
132 |
+ oldBold = BrightRed |
|
133 |
+ oldDimmed = Red |
|
134 |
+ new = BrightGreen |
|
135 |
+ newBold = BrightGreen |
|
136 |
+ newDimmed = Green |
|
137 |
+ oldMoved = BrightMagenta |
|
138 |
+ oldMovedDimmed = Magenta |
|
139 |
+ oldMovedAlternative = Magenta |
|
140 |
+ oldMovedAlternativeDimmed = Magenta |
|
141 |
+ newMoved = BrightCyan |
|
142 |
+ newMovedDimmed = Cyan |
|
143 |
+ newMovedAlternative = Cyan |
|
144 |
+ newMovedAlternativeDimmed = Cyan |
|
145 |
+ |
|
146 |
+[blame] |
|
147 |
+ coloring = repeatedLines |
|
148 |
+ ; coloring = highlightRecent |
|
149 |
+ |
|
150 |
+[color "blame"] |
|
151 |
+ repeatedLines = White |
|
152 |
+ highlightRecent = \ |
|
153 |
+ 245, 1 years ago, \ |
|
154 |
+ 246, 6 months ago, \ |
|
155 |
+ 247, 5 months ago, \ |
|
156 |
+ 248, 4 months ago, \ |
|
157 |
+ 249, 3 months ago, \ |
|
158 |
+ 250, 2 months ago, \ |
|
159 |
+ 251, 4 weeks ago, \ |
|
160 |
+ 252, 3 weeks ago, \ |
|
161 |
+ 253, 2 weeks ago, \ |
|
162 |
+ 254, 1 weeks ago, \ |
|
163 |
+ 255 |
... | ... |
@@ -54,3 +54,33 @@ |
54 | 54 |
[diff] |
55 | 55 |
renames = copies |
56 | 56 |
algorithm = histogram |
57 |
+ |
|
58 |
+[url "ssh://git@"] |
|
59 |
+ pushInsteadOf = https:// |
|
60 |
+ |
|
61 |
+[protocol] |
|
62 |
+ allow = never |
|
63 |
+ |
|
64 |
+[protocol "file"] |
|
65 |
+ allow = always |
|
66 |
+ |
|
67 |
+[protocol "ssh"] |
|
68 |
+ allow = always |
|
69 |
+ |
|
70 |
+[protocol "https"] |
|
71 |
+ allow = always |
|
72 |
+ |
|
73 |
+[transfer] |
|
74 |
+ fsckObjects = true |
|
75 |
+ |
|
76 |
+[fsck] |
|
77 |
+ zeroPaddedFilemode = warn |
|
78 |
+ badTimezone = warn |
|
79 |
+ |
|
80 |
+[receive "fsck"] |
|
81 |
+ zeroPaddedFilemode = warn |
|
82 |
+ badTimezone = warn |
|
83 |
+ |
|
84 |
+[fetch "fsck"] |
|
85 |
+ zeroPaddedFilemode = warn |
|
86 |
+ badTimezone = warn |
... | ... |
@@ -13,3 +13,33 @@ |
13 | 13 |
|
14 | 14 |
[init] |
15 | 15 |
templateDir = ~/.gittemplate |
16 |
+ defaultBranch = master |
|
17 |
+ ; defaultBranch = main |
|
18 |
+ |
|
19 |
+[remote] |
|
20 |
+ pushDefault = origin |
|
21 |
+ |
|
22 |
+[push] |
|
23 |
+ default = current |
|
24 |
+ recurseSubmodules = check |
|
25 |
+ |
|
26 |
+[branch] |
|
27 |
+ autoSetupMerge = always |
|
28 |
+ autoSetupRebase = always |
|
29 |
+ |
|
30 |
+[fetch] |
|
31 |
+ prune = true |
|
32 |
+ pruneTags = true |
|
33 |
+ |
|
34 |
+[rebase] |
|
35 |
+ autoSquash = true |
|
36 |
+ autoStash = true |
|
37 |
+ updateRefs = true |
|
38 |
+ missingCommitsCheck = error |
|
39 |
+ |
|
40 |
+[pull] |
|
41 |
+ rebase = merges |
|
42 |
+ |
|
43 |
+[merge] |
|
44 |
+ ff = false |
|
45 |
+ autoStash = true |
... | ... |
@@ -1,2 +1,9 @@ |
1 | 1 |
[include] |
2 | 2 |
path = ~/.gitconfig-user |
3 |
+ |
|
4 |
+[core] |
|
5 |
+ ; Git sets `$LESS` to `FRX` if it's not already set. `X` disables |
|
6 |
+ ; sending termcap initialization and deinitialization strings to the |
|
7 |
+ ; terminal, which leaves (potentially log) text on the screen and |
|
8 |
+ ; disables mouse scrolling. |
|
9 |
+ pager = less -+X |