-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
251 lines (234 loc) · 8.28 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
# NOTE: Some of these values are overriden, such as user.email, user.signingkey,
# gpg.program, etc.
# See the bottom of the file for those overrides
[user]
name = Jason Weir
email = [email protected]
[color]
branch = auto
diff = auto
interactive = auto
status = auto
ui = auto
grep = auto
[color "branch"]
current = green bold
local = green
remote = red bold
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = green bold
changed = yellow bold
untracked = red
[color "grep"]
filename = yellow bold
linenumber = green
[color "sh"]
branch = yellow
[merge]
tool = vimdiff
stat = true
[push]
default = current # Also: nothing, current, upstream, simple, matching
[branch]
autosetuprebase = always
[diff]
renames = copies
mnemonicprefix = true
[svn]
r
[alias]
ad = add
st = status
ci = commit
civ = commit --no-verify
br = branch
co = checkout
df = diff
dfw = diff --color-words -b
dfs = diff --staged
cherry-pick = cherry-pick --no-commit
cp = cherry-pick --no-commit
ammend = commit --amend -C HEAD
fp = push --force-with-lease
rm = rm --ignore-unmatch
# Used to copy the last commit message because github reformats like a butt
cplm = "!f() { \
git log HEAD^.. | grep '^ ' | sed 's/^ *//' | tail -n +3 | pbcopy; \
}; f"
# Used by other aliases
remoterepo = "!f() { \
repo=$(git remote -v | grep origin | grep -m 1 \"(push)\" | sed -e 's/.*github.com.\\(.*\\) .*/\\1/g' | sed -e 's/\\.git//g' ); \
echo $repo; \
}; f"
reponame = "!f() { \
name=$(basename $(git remote get-url origin) .git); \
echo $name; \
}; f"
defaultbranch = "!f() { \
git remote show origin | grep 'HEAD branch' | cut -d' ' -f5; \
}; f"
# Open Repo in github
hub = "!f() { repo=$(git remoterepo); \
url=https://github.com/$repo; echo $url; echo ''; \
open $url > /dev/null 2>&1; \
}; f"
# Github Pull Request
pr = "!f() { gh pr create --reviewer $(cat ~/.config/gh/reviewers | tr '\n' ',') ; }; f"
prurl = "!f() { branch=$(git rev-parse --abbrev-ref HEAD); \
repo=$(git remoterepo); \
url=https://github.com/$repo/pull/new/$branch; echo $url; echo ''; \
git cplm; \
open $url > /dev/null 2>&1; \
}; f"
prurlcp = "!f() { \
url=$(BROWSER=echo gh pr view --web); \
echo $url | pbcopy; \
echo $url copied to clipboard; \
}; f"
propen = "!f() { \
branch=$(git rev-parse --abbrev-ref HEAD); \
defaultbranch=$(git defaultbranch); \
git track && git pull && git push && git prurl && echo '' && \
git co $defaultbranch && git br -d $branch; \
}; f"
openpr=propen
# Open CircleCI: opens url https://circleci.com/gh/<ORG>/<REPO>
cci = "!f() { repo=$(git remoterepo); \
url=https://circleci.com/gh/$repo; echo $url; echo ''; \
open $url > /dev/null 2>&1; \
}; f"
# Open CodeFresh: opens url https://g.codefresh.io/builds2?filter=repository:<REPO>
cf = "!f() { repo=$(git reponame); \
url=https://g.codefresh.io/builds2?filter=repository:$repo; echo $url; echo ''; \
open $url > /dev/null 2>&1; \
}; f"
# Replace a file with the version at a specific hash
overwrite = "!f() { \
commit=0dd165a; \
for file in $@; do \
git show $commit:$file > $file; \
git add $file; \
done; \
}; f"
ow=overwrite
# Pick a single file for which to show the diff using facebook path picker
dff = "!f() { git -c color.status=always status | fpp -c 'git df'; }; f"
# Pick a single file for which to checkout using facebook path picker
cof = "!f() { git -c color.status=always status | fpp -c 'git co'; }; f"
# Edit in vim all modified and untracked files
vi = "!f() { git status --porcelain | sed -n 's/^\\( M\\|??\\) //p' | tr \"\\n\" ' ' | xargs bash -c 'vim \"$@\" < /dev/tty' ignoreme; }; f"
# Commit with branch name appended
cim = "!f() { branch=$(git rev-parse --abbrev-ref HEAD) && git commit -m \"$1 -- $branch\"; }; f"
# create branch on remote
cob = "!f() { git pull && git co -b $1 && branch=$(git rev-parse --abbrev-ref HEAD) && git push --set-upstream origin $branch; }; f"
# forget this --set-upstream business.
track = "!f(){ branch=$(git rev-parse --abbrev-ref HEAD); cmd=\"git branch --set-upstream-to=${1:-origin}/${2:-$branch} ${2:-$branch}\"; $cmd; }; f"
# unstash files
unstash = stash apply --index
# pull/push
pp = "!git pull && git push"
# 'add all' stages all new+changed+deleted files
aa = !git ls-files -d | xargs -r git rm && git ls-files -m -o --exclude-standard | xargs -r git add
#
aup = "!sh -c 'git ls-files -m | grep $1 | xargs -r git add' -"
# 'add grep' stages all new+changed that match $1
ag = "!sh -c 'git ls-files -m -o --exclude-standard | grep $1 | xargs -r git add' -"
#
agp = "!sh -c 'git ls-files -m -o --exclude-standard | grep $1 | xargs -r git add -p' -"
# 'checkout grep' checkouts any files that match $1
cg = "!sh -c 'git ls-files -m | grep $1 | xargs -r git checkout' -"
# 'diff grep' diffs any files that match $1
dg = "!sh -c 'git ls-files -m | grep $1 | xargs -r git diff' -"
# 'patch grep' diff --cached any files that match $1
pg = "!sh -c 'git ls-files -m | grep $1 | xargs -r git diff --cached' -"
# 'remove grep' remove any files that match $1
rmg = "!sh -c 'git ls-files -d | grep $1 | xargs -r git rm' -"
# 'reset grep' reset any files that match $1
rsg = "!sh -c 'git ls-files -c | grep $1 | xargs -r git reset' -"
# nice log output
lg = log --graph --pretty=oneline --abbrev-commit --decorate
# rerun svn show-ignore -> exclude
si = !git svn show-ignore > .git/info/exclude
# start git-sh
sh = !git-sh
# Grep like ack
ack = grep --break --heading --line-number --color=always -I
ick = grep --break --heading --line-number --color=always -I --ignore-case
# Pretend I haven't changed things
ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
[core]
excludesfile = ~/.gitignore_global
quotepath = false
whitespace = trailing-space,space-before-tab
pager = diff-so-fancy | less --tabs=4 -RFX
[init]
templatedir = ~/.gittemplate
defaultBranch = main
[grep]
lineNumber = true
[branch]
autosetupmerge = true
[hooks]
tagmatchpattern = jweir|todo
[flake8]
strict = true
[pull]
rebase = false
[commit]
gpgsign = true
[gpg]
program = /opt/homebrew/bin/gpg
[diff "sopsdiffer"]
textconv = sops -d
[url "ssh://[email protected]"]
insteadOf = https://github.com
[credential]
helper = osxkeychain
[help]
autocorrect = 1
# TODO: test out p4merge
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_external_merge_tools
# [merge]
# tool = extMerge
# [mergetool "extMerge"]
# cmd = extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
# trustExitCode = false
# [diff]
# external = extDiff
[mergetool]
keepBackup = false
[rerere]
enabled = true
[secrets]
providers = git secrets --aws-provider
patterns = (A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}
patterns = (\"|')?(AWS|aws|Aws)?_?(SECRET|secret|Secret)?_?(ACCESS|access|Access)?_?(KEY|key|Key)(\"|')?\\s*(:|=>|=)\\s*(\"|')?[A-Za-z0-9/\\+=]{40}(\"|')?
patterns = (\"|')?(AWS|aws|Aws)?_?(ACCOUNT|account|Account)_?(ID|id|Id)?(\"|')?\\s*(:|=>|=)\\s*(\"|')?[0-9]{4}\\-?[0-9]{4}\\-?[0-9]{4}(\"|')?
allowed = AKIAIOSFODNN7EXAMPLE
allowed = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
patterns = private_key
patterns = private_key_id
[interactive]
diffFilter = diff-so-fancy --patch
textconv = sops -d
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
# Include local uncommitted changes (signing key, gpg.program, etc.)
[includeIf "gitdir:~/"]
path = ~/.gitconfig.local.inc
# Include local overrides for termly (user)
[includeIf "gitdir:~/Sites/termly/"]
path = ~/Sites/termly/.gitconfig.inc
[includeIf "gitdir:/tmp/"]
path = ~/Sites/termly/.gitconfig.inc
[safe]
directory = *