-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitconfig
134 lines (116 loc) · 5.06 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
[alias]
word-diff = diff --word-diff
diffword = diff --word-diff
pretty = log --graph --date-order --pretty=mypretty --abbrev-commit --date=relative
# fshow = "!f() { : git log; selected=$(git pretty --all --color=always \"$@\" | fzf --ansi | cut -d \\' -f2 | cut -d ' ' -f1); test \"$?\" -eq 0 && git show \"$selected\"; }; f"
pretty2 = log --graph --all --format=mypretty2 --abbrev-commit
# "git pul" => git pull + git pretty with the updated revisions
# save current HEAD (avoid logging later if we didn't update it)
# git rev-parse @{1} trick is so we don't log if we don't have enough reflog (we need two entries for this head in the reflog for this head to be useful)
# COUNT: revisions between the last state of this head to the current state
# if they're too many to automatically print (maybe have a git config to set this?), we just emit a message with the revs we'd print
# otherwise, do a git pretty between the last state of the current head and the current one
pul = "!f() { : git pull; MAX_COUNT=100; OLD_HEAD=\"$(git rev-parse HEAD)\"; git pull \"$@\" && { [ \"${OLD_HEAD}\" = \"$(git rev-parse HEAD)\" ] && return 0; $(git rev-parse @{1} >/dev/null 2>/dev/null) || return 0; COUNT=$(git rev-list --no-merges --count @{1}..); if [ \"${COUNT}\" -gt ${MAX_COUNT} ]; then echo \"too many revisions between @{1} and HEAD (${COUNT}), not doing a git pretty --no-merges $(git rev-parse --short @{1})..$(git rev-parse --short HEAD)\"; else git pretty --no-merges @{1}..; fi; }; }; f"
pushf = push --force-with-lease
fpush = push --force-with-lease
# Use the null command as a hint to git-completion.bash
trymerge = "!f() { : git merge; git merge --no-commit \"$@\" || echo FAILED, please choose an earlier commit; echo Undoing changes; git merge --abort; }; f"
uplog = log @{upstream}..
# probably doesn'y need the null command as we want to complete the very first command which should be auto-detected
fuplog = "!f() { : git fetch; git fetch \"$@\" && git uplog; }; f"
[branch]
sort = -committerdate
[column]
ui = auto
# ui = auto,row,dense
[commit]
verbose = true
[core]
autocrlf = false
hooksPath = ~/.config/git-hooks
longpaths = true
# speeds up git status on huge repos by a log
# run `git update-index --test-untracked-cache` to ensure the current FS supports it properly
untrackedcache = true
[diff]
algorithm = histogram
# make stat lines have a few more characters for filenames at the expense
# of dynamic range of the graph part
statGraphWidth = 5
[merge]
conflictstyle = diff3
tool = vimdiff
[mergetool "fugitive"]
# vim-fugitive mergetool from
# https://vi.stackexchange.com/questions/3985/git-mergetool-vimdiff-command
cmd = vim "+Gdiff" $MERGED
# Test diff-highlight, which should be a bit better than regular word highlight
[pager]
# less -RFX. -X (--no-init) is because termcap's deinit stuff sometimes
# clears the screen and I don't want that
log = diff-highlight | less --RAW-CONTROL-CHARS --quit-if-one-screen --no-init
show = diff-highlight | less --RAW-CONTROL-CHARS --quit-if-one-screen --no-init
diff = diff-highlight | less --RAW-CONTROL-CHARS --quit-if-one-screen --no-init
# pretty formats to abbreviate the git pretty commands
[pretty.mypretty]
format = format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset
[pretty.mypretty2]
format = format:%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)
[fetch]
# write commit graphs on fetch to get faster log --graph when maintenance is not on
writeCommitGraph = true
[rebase]
autoSquash = true
autoStash = true
[pull]
rebase = true
[push]
default = simple
[user]
name = Filipe Cabecinhas
# Some corporate firewalls don't let git:// protocols go through. Let's try
# assuming that we have an equivalent https:// access to any repos we need
[url "https://"]
insteadOf = git://
# From: https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0
# for $deity's sake, check that anything we're getting is complete and sane on
# a regular basis
[transfer]
fsckobjects = true
[fetch]
fsckobjects = true
[receive]
fsckObjects = true
[init]
defaultBranch = main
[rerere]
enabled = 1
##########################################
# testing delta:
[core]
pager = delta || diff-highlight | less
# overwrite the previously-set values
[pager]
log = delta || diff-highlight | less
show = delta || diff-highlight | less
diff = delta || diff-highlight | less
[interactive]
# https://github.com/dandavison/delta/issues/1650
# seems like only piping diffFilter through cat fixes the `git add -p`
# hang, --paging=never on delta is not enough
diffFilter = delta --color-only | cat
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
[include]
path = ./.git-delta-themes
[delta]
; navigate = true # use n and N to move between diff sections
tabs = 4
# must run `bat cache --build` before this takes properly:
syntax-theme = Dracula # any `bat` theme
features = arctic-fox zebra-dark
##########################################
[submodule]
recurse = true