-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy path.gitconfig
262 lines (198 loc) · 7.98 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
[user]
name = Roman Ožana
username = OzzyCzech
email = [email protected]
#####################################################################################################################################
# Core settings
#####################################################################################################################################
[core]
editor = nano
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
whitespace = fix,trailing-space,cr-at-eol
# Make `git rebase` safer on macOS
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
precomposeunicode = false
[init]
defaultBranch = main
[diff]
renames = copies
[diff "bin"]
textconv = hexdump -v -C
[push]
default = current
# Make `git push` push relevant annotated tags when pushing branches out.
followTags = true
[pull]
rebase = true
[merge]
log = true
[fetch]
prune = true
output = compact
[status]
showStash = true
submoduleSummary = true
[rebase]
missingCommitsCheck = warn
abbreviateCommands = false
instructionFormat = %<(60,trunc)%s %cn <%ce> [GPG: %G?% GK]
untrackedCache = true
autoSquash = true
autoStash = true
stat = true
[tag]
sort = -taggerdate
[apply]
whitespace = fix
# See https://help.github.com/articles/checking-out-pull-requests-locally
[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
#####################################################################################################################################
# Git log settings
# git log --pretty=[si|mu]
#####################################################################################################################################
[log]
abbrevCommit = true
decorate = short
date = format:%Y-%m-%d %R
follow = true
graphColors = 1,2,3,4,5,6,8,166,9,10,11,12,13,14,15,208
showRoot = true
mailmap = true
[format]
pretty = si
[pretty]
si = tformat:%C(auto)%h%C(reset) %C(blue italic)%ad%C(reset) %s%C(auto)%d%C(reset) %C(241)%aN%C(reset) %C(italic 241)<%aE>%C(reset)
mu = format:%C(auto)%h%C(reset) %C(white)-%C(reset) %C(italic blue)%ad%C(reset) %C(italic cyan)(%ar)%C(reset)%C(auto)%d%C(reset)%n %C(white)⤷%C(reset) %s %C(241)- %aN <%aE>%C(reset)%n
#####################################################################################################################################
# Git advice settings
#####################################################################################################################################
[advice]
pushUpdateRejected = false
statusHints = false
statusUoption = false
commitBeforeMerge = false
resolveConflict = false
implicitIdentity = false
detachedHead = false
amWorkDir = true
rmHints = true
addEmbeddedRepo = false
ignoredHook = true
waitingForEditor = false
#####################################################################################################################################
# Colors
#####################################################################################################################################
[color]
ui = auto
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow bold
local = 10
remote = 9
upstream = 208
plain = 15
[color "diff"]
meta = blue
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
#####################################################################################################################################
# Aliases
#####################################################################################################################################
[alias]
# initialize repository in current directory
# git this [<git-init-args>...]
this = "!f() { git init \"$@\" && git commit --message='Initialize' --allow-empty; }; f"
# open git repository in browser
# git open [<remote>]
open = "!f() { open $(git config remote.${1:-origin}.url | sed -E 's/:([^\\/])/\\/\\1/g' | sed -e 's/ssh:\\/\\///g' | sed -e 's/git@/https:\\/\\//g' | sed -e 's/\\.git$//g'); }; f"
# show contributors
# git who
who = shortlog --summary --numbered --no-merges
which = branch --all --contains
which-tag = describe --always --contains
who = shortlog --summary --numbered --no-merges
whoami = "!echo $(git config --get user.name) '<'$(git config --get user.email)'>'"
# Show the diff between the latest commit and the current state
d = !git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat
# Switch to a branch, creating it if necessary
go = switch -c
# Determinate what's default branch
main = !basename $(git symbolic-ref --short refs/remotes/origin/HEAD)
# Show latest hash short
hash = rev-parse --short HEAD
hash-full = rev-parse HEAD
# show current remote url
url = ls-remote --get-url
# Pull in remote changes for the current repository and all its submodules
up = !git fetch origin --prune --prune-tags && git pull --rebase --prune --tags --all && git submodule sync --recursive && git submodule update --init --recursive
# Commit ALL && push ALL
save = !"save() { git add --all && git commit -am \"${@:-WIP}\" && git push origin; }; save"
# Backup whole git repo to bundle
backup = !"gb() { target=$(echo ${1#*:} | tr / _); git clone --mirror $1 ${target} && cd ${target}; git bundle create ${2-../}/${target%%.git}.bundle --all; cd - && rm -rf ${target}; }; gb"
# Unstage last commit
unstage = reset --soft HEAD~
# Undo last commit
undo = reset --hard HEAD~
# Commit all changes
commit-all = !git add -A && git commit -am
# Amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# Last ... something
last-year = shortlog -sn --all --no-merges --since '1 year ago'
# show logs as markdown formatted list
markdown = log --color --pretty=format:'- %Cred`%h`%Creset %s %C(bold blue)[%an](mailto:%ae)%Creset' --abbrev-commit --dense --no-merges
# prepare release notes
release-notes = !sh -c 'git markdown --reverse ...`git describe --tags --abbrev=0`'
# delete branch
delete-branch = branch -D
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
delete-merged = !git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d
# prune local tags (delete not pushed tags)
prune = fetch --prune --prune-tags
# remove untracked dirs, ignored files with force !
cleanup = !git fetch --prune --tags && git clean -xdf
# Thin out older metadata within the repository, remove unnecessary files
trim = !git reflog expire --expire=now --all && git gc --prune=now
# show all remotes
remotes = remote -v
# allow empty commit with message
empty = commit --allow-empty -m
# Return the repository's root directory (useful for shell prompts)
root = rev-parse --show-toplevel
# Commits as Work in Progress.
wip = commit -am "WIP"
# List functions
list-commits = log --oneline --decorate
# List tags
list-aliases = config --get-regexp alias
list-conflicts = !git ls-files -u | cut -f 2 | sort -u
list-branches = branch -av
list-remote-branches = branch -r
list-remotes = remote -v
list-tags = for-each-ref --sort=-taggerdate --format '%(taggerdate:short): %(refname:short) %(objectname:short)' refs/tags
list-remote-tags = ls-remote --tags origin
list-local-tags = !git ls-remote --tags origin | git show-ref --tags --exclude-existing
# Latest content
latest-tag = describe --tags --abbrev=0
latest-changes = show --pretty="format:" --name-only
# Searching
find-branch = "!f() { git branch -a --contains $1; }; f"
find-tag = "!f() { git describe --always --contains $1; }; f"
find-commits = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
find-message = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# yolo (commit with random message)!!!
yolo = !git commit -am \"$(curl --silent --fail https://whatthecommit.com/index.txt)\" && git push origin