-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathgitconfig
More file actions
280 lines (276 loc) · 10.2 KB
/
gitconfig
File metadata and controls
280 lines (276 loc) · 10.2 KB
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
278
279
280
[user]
# Name used in commit messages.
name = Mike McQuaid
# Email used in commit messages.
email = mike@mikemcquaid.com
[include]
# OS-specific (e.g. macOS) Git configuration
path = ~/.gitconfig.local
[github]
# GitHub username for command-line tools.
user = MikeMcQuaid
[color]
# Colour terminal command output when possible.
ui = auto
[gist]
# Open GitHub Gist in browser after submission.
browse = true
[push]
# Push to the set upstream branch being tracked by default.
default = simple
# Automatically create remotes if they don't exist.
autoSetupRemote = true
[pull]
# Default to rebasing on pulls
rebase = true
[fetch]
# Always prune when fetching (and pulling).
prune = true
# Always fetch all remotes.
all = true
# Write commit graph to speed up some repositories.
writeCommitGraph = true
[gc]
# Write commit graph to speed up some repositories.
writeCommitGraph = true
[rerere]
# Store and re-use manual conflict resolution changes.
enabled = true
# Automatically re-apply resolutions if seen again
autoupdate = true
[core]
# Exclude everything this file. Used for general exclusions.
excludesfile = ~/.gitignore
# Set attributes on files. Used for general diff improvements.
attributesfile = ~/.gitattributes
# Run shared hooks for every repository.
hooksPath = ~/.git-hooks
# Don't prompt for commit messages for merge commits.
mergeoptions = --no-edit
# Speed up some repositories.
commitGraph = true
# Output unicode characters (e.g. emoji).
quotepath = on
[help]
# Autocorrect mistyped commands.
autocorrect = 1
[alias]
## 'New' Commands
# Unstage the changes in a given file.
unstage = reset HEAD --
# View the current changes in the staging area.
staged = diff --cached
# Print the name of the current branch.
current-branch = symbolic-ref --short HEAD
# Print the name of the current upstream tracking branch.
upstream = !git config --get branch.$(git current-branch).remote \
|| echo origin
# Cherry-pick a commit with your signature.
sign = cherry-pick --signoff
# List all current SVN externals for this repository.
svn-externals = !git svn show-externals | grep -x \\"[^#].*\\"
# Create a git:// server of the current repository.
# WARNING: this gives all users read/write access
# without authentication (so only use on trusted networks).
serve = !git daemon --reuseaddr --export-all --base-path=. \
--verbose ./.git
# Merge a branch and commit a merge commit (even if one
# isn't needed)
noff = merge --no-ff
# Merge a branch with a merge commit and resolve any conflicts
# always using that branch's version rather than the current branch.
theirs = !git noff -Xtheirs
# Rebase the current branch against upstream/HEAD.
rebase-against-head = !git rebase $(git upstream)/HEAD
# Push the current branch upstream to origin using the same branch
# name for the remote branch.
upstream-current-branch = !git push --set-upstream origin \
$(git current-branch)
# Create a pull request on GitHub using the `gh` command.
pull-request = !rm -f "$(git rev-parse --git-path PULLREQ_EDITMSG)" && gh pr create --web
# Upstream the current branch to origin and create a pull request
# on GitHub.
upstream-and-pull-request = !git upstream-current-branch \
&& git pull-request
# Get the current diff but show differences between characters
# instead of just the differences between lines.
word-diff = diff --word-diff
# Push the current branch and set it as the default upstream branch.
push-and-set-upstream = push --set-upstream
# Create a new branch by checking out another branch.
checkout-as-new-branch = checkout -b
# Rebase against origin/HEAD and prompt for what operations
# should be performed.
interactively-rebase-against-origin-head = \
!git rev-parse --verify --quiet origin/HEAD >/dev/null || git remote set-head origin --auto && \
git rebase --interactive origin/HEAD
# Show the commit log with a prettier, clearer history.
pretty-one-line-log = log --graph --oneline --decorate
# Commit any changes to files, squash them into the last commit
# and update its date.
fix-up-previous-commit = !git commit --all --amend \
--no-edit --date=\"$(date)\" #"
# Commit a work-in-progress commit (to use with
# fix-up-previous-commit)
work-in-progress = commit -a -m 'WIP'
# Merge a branch with a merge commit and use the more time-consuming
# patience diff algorithm
patience = !git noff -Xpatience
# Hard reset branch to the upstream version.
hard-reset = !git reset --hard $(git upstream)/$(git current-branch)
# Assume the specified file is unchanged to stop changes
# being seen by Git
assume = update-index --assume-unchanged
# No longer assume a specified file remains unchanged
unassume = update-index --no-assume-unchanged
# List all files that are assumed to be unchanged
assumed = !git ls-files -v | grep '^[hsmrck?]' | cut -c 3-
# Delete all non-master/main branches
delete-merged = !git branch --merged | grep -vE ' (master|main|trunk)$' | grep -vE '^(\\*|\\+)' | xargs -n 1 git branch -D
# Get the merge-base compared to origin/HEAD
merge-base-head = merge-base origin/HEAD HEAD
# Diff against the current branch's merge-base
diff-merge-base = !git diff $(git merge-base-head)
# Diff against the upstream branch
diff-upstream = !git diff $(git upstream)/$(git current-branch)
# Reset the current branch to the sandvault version
sandvault-reset = !git reset --hard sandvault/$(git current-branch)
# Open a sandvault shell in the current repository or worktree.
sv = !sv shell "$(pwd)"
# Push the current branch upstream to MikeMcQuaid using the same
# branch name for the remote branch.
um = !(git remote -v | grep -q MikeMcQuaid || gh repo fork --remote --remote-name MikeMcQuaid) \
&& gh repo set-default $(git remote get-url origin) \
&& git push --set-upstream MikeMcQuaid $(git current-branch)
# Push the current branch to MikeMcQuaid and open a pull request.
umpr = !git um && gh pr create --web --head MikeMcQuaid:$(git current-branch)
## Codebase Audit Commands
# Show the 20 most-changed files in the last year.
churn = !git log --format=format: --name-only --since='1 year ago' \
| sort | uniq -c | sort -nr | head -20
# Show contributors ranked by commit count.
bus-factor = shortlog -sn --no-merges
# Show files most associated with bug-fix commits.
bug-hotspots = !git log -i -E --grep='fix|bug|broken' \
--name-only --format='' \
| sort | uniq -c | sort -nr | head -20
# Show commit count by month for the entire history.
commit-velocity = !git log --format='%ad' --date=format:'%Y-%m' \
| sort | uniq -c
# Show reverts, hotfixes, and emergency commits in the last year.
firefighting = !git log --oneline --since='1 year ago' \
| grep -iE 'revert|hotfix|emergency|rollback'
## Shortened 'New' Commands
fspr = !git fix-up-previous-commit --gpg-sign && git upstream-and-pull-request
frb = !git fetch && git rebase-against-head
rah = !git rebase-against-head
wip = !git work-in-progress
fpf = !git fix-up-previous-commit --gpg-sign && git push --force-with-lease
fs = !git fix-up-previous-commit --gpg-sign
pr = !git upstream-and-pull-request
up = !git upstream-current-branch
fa = !git fetch --all
pf = !git push --force-with-lease
dm = !git diff-merge-base
du = !git diff-upstream
mb = !git merge-base-head
w = !git word-diff
u = !git push-and-set-upstream
b = !git checkout-as-new-branch
i = !git interactively-rebase-against-origin-head
# `true` needed as the return status is wrong otherwise.
l = !git pretty-one-line-log || true
f = !git fix-up-previous-commit
## Shortened Existing Commands
p = pull
s = status --short --branch
[instaweb]
# Use the Ruby WEBRick library when creating a `git instaweb`
# HTTP server.
httpd = webrick
[diff]
# Use the better histogram diff algorithm
algorithm = histogram
# Use new diff algorithm to make e.g. function diffs look better.
compactionheuristic = true
# Use a different colour for moved lines than added/modified ones
colorMoved = true
# Use more Git-internals specific prefixes for diff hunks
mnemonicPrefix = true
# Detect if a file has been renamed
renames = true
[grep]
# Use Perl regexes for grep
patternType = perl
[diff "xml"]
textconv = xmllint --format --recover
[mergetool]
# Don't prompt before opening the merge tool.
prompt = false
# Don't keep backups of the merge tool inputs.
keepBackup = false
# Don't keep the merge tool temporary input/output files.
keepTemporaries = false
[apply]
# Cleanup whitespace by default when apply patches.
whitespace = fix
[rebase]
# Run `git stash` if needed before a `git rebase`
autoStash = true
# Auto-add `--autosquash` to `git rebase`
autoSquash = true
[url "git@github.com:"]
# Use SSH for GitHub instead of https://
# Enable this in networks where https:// has issues.
# insteadOf = https://github.com/
[credential]
# Use my custom dotfiles credentials helper.
helper = dotfiles
[credential "https://github.com"]
username = MikeMcQuaid
[hub]
# Use HTTPS rather than SSH protocol in Hub
protocol = https
# Settings for Git LFS
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
process = git-lfs filter-process
[commit]
# Show the diff as a comment in the commit message template.
verbose = true
[branch]
# Sort branches by committer date.
sort = -committerdate
[tag]
# Sort tags by newest first
sort = -version:refname
[protocol]
# Use Git v2 protocol for better performance
version = 2
[log]
# Print more readable dates in `git log`
date = human
# git-delta settings
[delta]
features = line-numbers decorations
file-decoration-style = ''
hunk-header-decoration-style = ''
[merge]
# Use 3-way diffs.
conflictstyle = diff3
[checkout]
# If in doubt about the branch to checkout, pick origin.
defaultRemote = origin
[init]
# Use same default branch name as GitHub.
defaultBranch = main
[advice]
# Don't warn about skipped cherry-picks.
skippedCherryPicks = false
[safe]
# It's expected that sandvault directories are owned by another user.
directory = /Users/Shared/sv-mike/repositories/*
directory = /Users/Shared/sv-mike/worktrees/brew/*
directory = /Users/Shared/sv-mike/worktrees/platform/*