-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
187 lines (139 loc) · 6.85 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
[core]
# checkout as-is ; commit as-is
autocrlf = false
eol = lf
ignorecase = false
whitespace = -trailing-space # Don't consider trailing space change as a cause for merge conflicts
fscache = true
editor = vim
excludesfile = ~/.dotfiles/.gitignore.global
################################################################################
[fetch]
prune = true # Before fetching, remove any remote-tracking references that no longer exist on the remote.
recurseSubmodules = true # Recursively fetch submodules
[merge]
ff = false # Always create a merge commit (never fast-forward)
[pull]
#rebase = true # Pull with rebase instead of merge
rebase = merges # also apply --rebase-merges (2.18+)
[push]
default = current # Push the current branch to update a branch with the same name on the receiving end
#default = upstream # Push the current branch back to the upstream (tracking) remote branch
#default = simple # Push the current branch with the same name on the remote. Refuses to push if the upstream branch’s name differs.
autoSetupRemote = true
useForceIfIncludes = true # Equivalent to specifying --force-if-includes
[rebase]
autosquash = true # Automatically squash commits made with --fixup
autostash = true # Automatically stash and re-apply
updateRefs = true # Automatically update branches that point to commits that are being rebased
[rerere]
enabled = true # Activate recording of resolved conflicts, so that identical conflict hunks can be resolved automatically
#autoupdate = true
[status]
#submoduleSummary = true # Shows a summary of commits for modified submodules
submoduleSummary = 3
#showUntrackedFiles = all # Show individual files in untracked directories
[tag]
sort = v:refname # Sort tags as version numbers (ex: 1.2.0 before 1.10.2)
################################################################################
[diff]
# Use better, descriptive initials : (i)ndex, (w)ork tree, (c)ommit, (o)bject instead of a/b.
mnemonicPrefix = true
# Lists the commits in the range like git-submodule[1] summary does
submodule = log
# Shows an inline diff of the changed contents of the submodule
#submodule = diff
# Show minimal diff when using --word-diff
wordRegex = .
[log]
# Use short SHAs when possible
abbrevCommit = true
# Continue listing the history of a file beyond renames
follow = true
# Exclude remote heads in log decorations
excludeDecoration = refs/remotes/*/HEAD
[pretty]
mingraph = %C(auto)%h%d %s
# graph = %C(auto)%h%d %<|(80)%s %C(green)%<(12)(%ar) %C(bold blue)<%aN>
graph = %C(auto)%h%d %<|(80)%s %C(bold blue) ✏ %<(12,trunc)%aN %Creset%C(green)⏱ %<(12,trunc)%ar
# graph-t = %C(auto)%h%d %<|(80,mtrunc)%s %C(green)(%ar) %C(bold blue)<%aN>
graph-t = %C(auto)%h%d %<|(80,mtrunc)%s %C(bold blue) ✏ %<(12,trunc)%aN %Creset%C(green)⏱ %<(12,trunc)%ar
graph-dyn = %C(auto)%h%d %<|(90)%s %C(green)(%<(13,trunc)%ar) %C(bold blue)<%aN>
graph-dyn-t = %C(auto)%h%d %<|(90,mtrunc)%s %C(green)(%<(13,trunc)%ar) %C(bold blue)<%aN>
graph-dyn-lg = %C(auto)%h%d %<|(70)%s %C(green)(%<(13,trunc)%ar) %C(bold blue)<%aN>
[gui]
encoding = utf-8
tabsize = 4
################################################################################
[alias]
# list available aliases
# https://brettterpstra.com/2014/08/04/shell-tricks-one-git-alias-to-rule-them-all/
aliases = "!~/.local/bin/git-aliases"
# status
st = "status"
# stash
ss = "stash push -u"
sp = "stash pop --index"
# Update
# Fast-forward main branch
fast-forward = "!~/.local/bin/git-fast-forward" # Git-Fork + WSLGit compat.
ff = "fast-forward"
update = "!~/.local/bin/git-update" # Git-Fork + WSLGit compat.
sup = "submodule update --init --recursive"
# log
graph = "log --color --graph --abbrev-commit --decorate --pretty=graph" # standard graph log
context-graph = "!~/.local/bin/git-context-graph" # "context-graph" (branch, default & remote)
cg = "context-graph --pretty=graph-dyn" # "context-graph" with dynamic columns
# commit
uncommit = "!f() { echo -n 'Uncommitting: '; git rev-parse --short HEAD; echo; git log -1 --pretty=%B; git reset --soft HEAD~1; }; f"
prev-commit = "!f() { git reflog | sed -n 2p | cut -d' ' -f1; }; f"
recommit = "!f() { echo -n 'Resetting to previous commit: '; git prev-commit; git reset --soft $(git prev-commit); }; f"
amend = "!f() { git commit -C $(git prev-commit); }; f"
fixup = "!f() { git commit --fixup ${1:-HEAD}; }; f"
# rebase
ri = "rebase -i"
rir = "rebase -i -r"
rib = "!f() { git rebase -i $(git mr base) $@; }; f"
rc = "rebase --continue"
ra = "rebase --abort"
# merge --continue, rebase --continue, whatever --continue
# https://www.eficode.com/blog/10-levels-of-git-aliases-advanced-and-beyond
continue = "!~/.local/bin/git-continue" # Git-Fork + WSLGit compat.
ct = "continue"
# push
force-push = "!~/.local/bin/git-force-push" # Git-Fork + WSLGit compat.
fp = "force-push"
fpu = "!f() { git force-push && git mr update; }; f"
pushall = "!f() { for remote in `git remote`; do git push $remote "$@"; done }; f"
fpushall = "!f() { for remote in `git remote`; do git force-push $remote "$@"; done }; f"
# git-mr
mr = "!~/.dotfiles/git-mr/git-mr" # Git-Fork + WSLGit compat.
# maintenance
gca = "gc --aggressive"
# https://tomschlick.com/git-forget/
# Lists local branches whose corresponding remote branch has been deleted
gone = ! git branch -vv | sed 's/^* / /' | awk '/: gone]/{print $1}'
# Deletes local branches whose corresponding remote branch has been deleted
forget = ! git fetch -p && [ ! -z \"`git gone`\" ] && (git gone | xargs git branch -D) || echo 'No branch to forget'
# branches
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
contains = "branch -a --contains"
# merged / non-merged branches
mb = "!f() { git branch -a --merged ${1:-master} | grep -v '>\\|*' | perl -pe s/^..//; }; f"
nmb = "!f() { git branch -a --no-merged ${1:-master} | grep -v '>\\|*' | perl -pe s/^..//; }; f"
# stale merged/non-merged branches
stmb = "!f() { for k in `git mb $1`; do git ld $k; done | sort -r; }; f"
stnmb = "!f() { for k in `git nmb $1`; do git ld $k; done | sort -r; }; f"
# remote non-origin branches
rnob = "!git branch -a | grep remotes/ | grep -v remotes/origin | sed -e 's/remotes\\///'"
# remove remote non-origin branches
rrnob = "!git branch -r -d $(git rnob)"
# transfer all refs from one remote to another
transfer-remote = "!f() { [ ! -z \"$1\" ] && [ ! -z \"$2\" ] && git push $2 +refs/remotes/$1/*:refs/heads/* +refs/tags/*:refs/tags/* ; }; f"
# Run git command in repo and submodules recursively
recurse = "!f() { git \"$@\"; git submodule foreach --recursive git \"$@\"; }; f"
# external commands
k = "!gitk --all"
mu = "!python ~/.dotfiles/mu-repo/mu"
[include]
path = ~/.dotfiles/.gitconfig.local