-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
201 lines (179 loc) · 7.38 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
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
# Nice gitconfig file with a few clever ideas:
# https://codeberg.org/scy/dotfiles/src/branch/main/.gitconfig
[user]
# Avoid trying to guess defaults for user.email and user.name, and instead
# retrieve the values only from the configuration.
#
# Requires either manually setting the name/email manually for each
# repository, or manually editing this file (or .gitconfig-local) for each
# machine. This will avoid accidentally commiting using the wrong
# name/email.
useConfigOnly = true
#name = Denilson Sá Maia
#email = [email protected]
#
# A newer solution is to use Conditional Includes:
# https://stackoverflow.com/a/43654115/124946
# https://git-scm.com/docs/git-config#_conditional_includes
# Look at the bottom of this file.
[github]
user = denilsonsa
#token = THIS_MUST_BE_SECRET
[init]
# Name the default branch "main", not "master".
# https://about.gitlab.com/blog/2021/03/10/new-git-default-branch-name/
defaultBranch = main
[core]
excludesfile = ~/.gitignore
# Look at gc.writeCommitGraph for more info
commitGraph = true
# https://github.com/so-fancy/diff-so-fancy
#pager = diff-so-fancy | less -RFX
# Default pager is usually "less -RFX", but it is also affected by the $LESS variable.
pager = less -RFX
[color]
ui = true
[pager]
# https://github.com/git/git/tree/master/contrib/diff-highlight
# Undefined subroutine &DiffHighlight::highlight_stdin called at /usr/share/doc/git/contrib/diff-highlight/diff-highlight.perl line 7.
# log = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight.perl | less
# show = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight.perl | less
# diff = perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight.perl | less
# log = diff-highlight | less
# show = diff-highlight | less
# diff = diff-highlight | less
blame = less -RFXS
[alias]
br = branch
ci = commit
co = checkout
st = status --short --branch
# If a `commit-msg` git hook fails, the commit message is still available.
# https://stackoverflow.com/questions/52975103/how-can-i-recover-the-commit-message-when-the-git-commit-msg-hook-fails
ce = !git commit --edit --file="$(git rev-parse --git-dir)/COMMIT_EDITMSG"
recommit = !git commit --edit --file="$(git rev-parse --git-dir)/COMMIT_EDITMSG"
# WARNING! This also deletes the stash.
gc-everything = !git reflog expire --expire-unreachable=now --all && git gc --prune=now
# Note: git log does not show reverted commits.
# Use --full-history to show those.
#
#glog = log --graph --decorate
#glog = log --graph --decorate --pretty=oneline --abbrev-commit
# http://www.jukie.net/bart/blog/pimping-out-git-log
# --graph is really slow for large repositories.
lgg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr / %ar) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lg = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr / %ar) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
#hist = log --graph --color=always --pretty='[%C(cyan)%h%Creset]%C(bold cyan)%d%Creset %s' --all
# Some more logging aliases that can be useful sometimes.
#
# --follow is good when files have been renamed/moved in the repository history.
# -p shows the changes for each matched commit.
#
# --author=<regex> tries to exclude commits whose author matches the regex,
# which is useful in case of many automated commits that bring no value to
# the person doing archeology on the repository.
#
#lf = log --follow -p --perl-regexp --author='^.*<([email protected]).*>.*$'
#lp = log -p --perl-regexp --author='^.*<([email protected]).*>.*$'
dirdiff = difftool --dir-diff
# "git branch foobar" creates a new branch.
# "git branch --list foobar" lists branches that match "foobar".
# "git branch" lists all (local) branches.
# "-a" or "--all" to list all branches.
branches = branch --list --all
#branches = for-each-ref --sort=-committerdate refs/heads/
# aliases that match the hg in / out commands
# https://github.com/sympy/sympy/wiki/Git-hg-rosetta-stone
out = !git fetch && git log FETCH_HEAD..
outgoing = !git fetch && git log FETCH_HEAD..
in = !git fetch && git log ..FETCH_HEAD
incoming = !git fetch && git log ..FETCH_HEAD
# -w to ignore whitespace.
# -M to detect moved lines within the file.
# -C to detect moved lines across files.
bl = blame -w -M
# --color-words is an alias to --word-diff=color
showw = show --color-words
diffw = diff --color-words
logw = log -p --color-words
meld = difftool -t meld --dir-diff
kdiff3 = difftool -t kdiff3 --dir-diff
# http://stackoverflow.com/questions/17558221/
showtool = "!showci () { rev=${1:-HEAD}; git difftool $rev~1 $rev; }; showci $1"
showmeld = "!showci () { rev=${1:-HEAD}; git difftool -t meld --dir-diff $rev~1 $rev; }; showci $1"
# git stash show that actually makes sense:
sshow = stash show -p
ssave = stash save
sdrop = stash drop
slist = stash list --pretty=format:\"%C(red)%h%C(reset) - %C(bold magenta)%gd%C(reset) %s %C(green)(%cr) %C(bold blue)<%an>%C(reset)\"
sapply = stash apply
spop = stash pop
# prp means Pull-Rebase-Push
prp = "!git pull --no-tags --rebase origin HEAD && git push"
# prs means Pull-Rebase-autoStash
# http://stackoverflow.com/questions/30208928/can-git-pull-automatically-stash-and-pop-pending-changes
prs = pull --rebase --autostash
# prsp means Pull-Rebase-autoStash-Push
prsp = "!git pull --no-tags --rebase --autostash origin HEAD && git push"
# When using GitLab, automatically create a Merge Request after pushing.
# https://docs.gitlab.com/ee/user/project/push_options.html
pushmr = push -o merge_request.create
configsetuser = "!git config --local user.name 'Denilson Sá Maia' && git config --local user.email '[email protected]' && echo 'Please consider updating [includeIf …] at ~/.gitconfig'"
configunsetuser = "!git config --local --unset user.name && git config --local --unset user.email"
[commit]
verbose = true
#template = ~/gitmessage.txt
[gc]
# https://blogs.msdn.microsoft.com/devops/2018/06/25/supercharging-the-git-commit-graph/
writeCommitGraph = true
[fetch]
# Auto-prune local branches that are tracking remote branches that don't exist anymore.
# https://stackoverflow.com/a/44129766
prune = true
[giggle]
main-window-view = HistoryView
history-view-vpane-position = 241
main-window-maximized = false
main-window-geometry = 1189x758+0+0
[push]
autoSetupRemote = true
default = simple
[merge]
# Suppress the git diff --stat after both git merge and git pull.
# https://stackoverflow.com/a/54865245
stat = false
[cola]
fontdiff = Inconsolata,9,-1,5,50,0,0,0,0,0
spellcheck = false
[gui]
editor = gvim
[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
[diff-so-fancy]
stripLeadingSymbols = false
[rerere]
enabled = true
[filter "dotfiles"]
clean = ~/dotfiles/git_filter.sh clean
smudge = ~/dotfiles/git_filter.sh smudge
# Per-directory configuration.
[includeIf "gitdir:~/dotfiles/"]
path = ~/.gitconfig-personal
[includeIf "gitdir:~/myrepos/"]
path = ~/.gitconfig-personal
[includeIf "gitdir:~/otherrepos/aur/"]
path = ~/.gitconfig-personal
[include]
# Use an additional, host-specific Git config (if it exists).
# It should be the last line in the config file.
path = ~/.gitconfig-local