-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
277 lines (231 loc) · 9.63 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
[user]
email = [email protected]
name = Matt Behrens
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[color]
pager = true
# Use colors in Git commands that are capable of colored output when
# outputting to the terminal. (This is the default setting in Git ≥ 1.8.4.)
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
commit = green bold
frag = magenta bold # line info
old = red # deletions
new = green # additions
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
whitespace = fix
[core]
excludesfile = ~/.gitignore
# Force pager to work with colors
#pager = less -FRSX
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on OS X
# 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
[alias]
# Add all (tracked and untracked)
aa = add --all
ci = commit -v
cm = commit -m
br = branch
co = checkout
# Commit all changes
ca = commit -a
# View the current working tree status using the short format
s = status -s
# Simple status, for piping
ss = "!git status -s | awk '{print $2}'"
# Switch to a branch, creating it if necessary
go = checkout -B
# WIP commit. Don't abuse this! Ignores precommit hook
wip = commit --no-verify -am "WIP"
wipp = "!git commit --no-verify -am 'WIP'; git push"
# remove the top commit, to unstaged index
pop = reset HEAD^
# kill the last commit
drop = reset --hard HEAD^
# list things
ls = ls-files
ls-ignored = ls-files --others -i --exclude-standard
# retouch all the files, for things that watch filesystem events
touch = "!git status -s | awk '{print $2}' | xargs touch"
# fetch all remotes
fall = fetch --all
# Remove branches that have already been merged with master
# a.k.a. ‘delete merged’
dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f"
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f"
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# List contributors with number of commits
contributors = shortlog --summary --numbered
# figure out what a revision is
human = name-rev --name-only --refs=refs/heads/*
# Current branch name, for piping
bname = rev-parse --abbrev-ref HEAD
# history
h = log --pretty=format:'%Cred%h%Creset (%Cgreen%cr%Creset) <%Cblue%an%Creset>%C(yellow)%d%Creset %s ' --graph --abbrev-commit --date=relative --topo-order
# flat history
hf = log --pretty=format:'%Cred%h%Creset (%Cgreen%cr%Creset) <%Cblue%an%Creset>%C(yellow)%d%Creset %s ' --abbrev-commit --date=relative --date-order --no-merges
hist-refs = log --all --graph --decorate --oneline --simplify-by-decoration --no-merges
hp = log -p --abbrev-commit --date=relative --color-words --abbrev
hist-patch = log -p --abbrev-commit --date=relative --color-words --abbrev
hs = log -M --summary --stat --abbrev-commit --date=relative --no-merges --date-order
hist-stat = log -M --summary --stat --abbrev-commit --date=relative --no-merges --date-order
# diff
staged = diff --patience --cached --patch-with-stat
un = diff --patience --patch-with-stat
unstaged = diff --patience --patch-with-stat
both = diff HEAD --patch-with-stat
ds = diff --stat -r
diff-stat = diff --stat -r
type = cat-file -t
dump = cat-file -p
# my history, ignore quiting less error
me = !git h --author="$GIT_AUTHOR_EMAIL" || TRUE
# open all current changed files in vim
edit = !vim -p `git diff HEAD --name-only`
e = !git edit
eg = !gvim -p `git diff HEAD --name-only`
sp = ![[ -z $(git status --porcelain -uno) ]] && git pull || git stash && git pull && git stash pop
#spp = ![[ -z $(git status --porcelain -uno) ]] && git pull || git stash && git pull && git push && git stash pop
pp = !git pull || true && git pull
#ppu = !git pp && git submodule sync && git submodule update --init
prune-all = !git prune-remote && git prune-merged && git prune-squashed
prune-remote = !git remote | xargs -n 1 git remote prune
prune-merged = !git branch --merged | grep -v \\* | xargs -n 1 git branch -d
prune-squashed = "!f() { local targetBranch=${1:-master} && git checkout -q $targetBranch && git branch --merged | grep -v \"\\*\" | xargs -n 1 git branch -d && git for-each-ref refs/heads/ \"--format=%(refname:short)\" | while read branch; do mergeBase=$(git merge-base $targetBranch $branch) && [[ $(git cherry $targetBranch $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == \"-\"* ]] && git branch -D $branch; done; }; f"
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; $EDITOR `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list git aliases
la = "!git config -l | grep alias | cut -c 7-"
# alias I prefer
publish = "!git push origin $(git branch-name)"
search = "!git log -S"$1" --no-merges -c --pretty=format:'%h %s [%an]'"
open = "!f() { \
remote=${1:-origin}; \
url=$(git remote get-url $remote); \
if [[ $url =~ ^git@([^:]+):([^/]+)/(.+).git$ ]]; then \
host=${BASH_REMATCH[1]}; \
user=${BASH_REMATCH[2]}; \
repo=${BASH_REMATCH[3]}; \
http_url="https://$host/$user/$repo"; \
case "$(uname -s)" in \
Darwin) open "$http_url" ;; \
Linux) xdg-open "$http_url" ;; \
MINGW*|MSYS*) start "$http_url" ;; \
*) echo "Unsupported operating system" ;; \
esac; \
else \
echo "Could not parse Git URL"; \
fi; \
}; f"
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[interactive]
diffFilter = delta --color-only
[delta]
features = side-by-side line-numbers decorations
whitespace-error-style = 22 reverse
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
[branch]
#When branching off a remote branch, automatically let the local branch track the remote branch:
autosetupmerge = true
#Always rebase!
autosetuprebase = always
[github]
user = askedrelic
[diff]
#Allow git diff to do basic rename and copy detection
renames = copies
#Tell git diff to use mnemonic prefixes (index, work tree, commit, object) instead of the standard a and b notation
mnemonicprefix = true
[push]
#When pushing without giving a refspec, push the current branch to its upstream branch.
default = tracking
# Make `git push` push relevant annotated tags when pushing branches out.
followTags = true
# Git 2.37.0 - automatically "--set-upstream origin"
autoSetupRemote = true
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
# diff3 is better than default
conflictStyle = diff3
# zdiff3 requires 2.35 https://github.blog/2022-01-24-highlights-from-git-2-35/
# zdiff3 doesn't wrok in rowanj-gitx :(
# conflictStyle = zdiff3
[difftool]
prompt = false
[grep]
extendedRegexp = true
[rebase]
autosquash = true
[help]
# Automatically correct and execute mistyped commands
autocorrect = 1
[gh]
protocol = https
autoUpdate = never
[credential "https://github.com"]
username = askedrelic
[http "https://gopkg.in"]
followRedirects = true
[init]
defaultBranch = main
[url "[email protected]:"]
insteadOf = https://github.com/
[pull]
ff = only
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true