-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgitconfig
More file actions
151 lines (144 loc) · 4.37 KB
/
gitconfig
File metadata and controls
151 lines (144 loc) · 4.37 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
[user]
name = Sam Moore
email = samandmoore@gmail.com
[github]
user = samandmoore
[include]
path = ~/.gitconfig.local
[help]
# Autocorrect mistyped commands.
autocorrect = 1
[credential "https://github.com"]
helper =
helper = !gh auth git-credential
[credential "https://gist.github.com"]
helper =
helper = !gh auth git-credential
[alias]
# View the current working tree status using the short format
s = status -s
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Commit all changes
ca = !git add -A && git commit -av
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# instead of blame
credit = blame
forkpoint = "!git merge-base --fork-point $1"
co = checkout
c = switch -c
create = switch -c
sw = switch
# View the SHA, description, and history graph of the latest 20 commits
l = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -n 20"
aa = "add -A ."
# verbose commit
ci = commit -v
# Amend last commit
ac = "!git ci --amend"
# just cherry pick
pick = cherry-pick
# show files with conflicts
conflicted = diff --name-only --diff-filter=U
# push and set upstream
pu = "push -u origin HEAD"
# push and set upstream, force but safely
puf = "push -u origin HEAD --force-with-lease"
puff = "!git puf"
# open in github web ui
browse = "!gh browse"
# open pr view in web ui
compare = "!gh pr create --web"
## 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'
[init]
# Use same default branch name as GitHub.
defaultBranch = main
[checkout]
# If in doubt about the branch to checkout, pick origin.
defaultRemote = origin
[fetch]
prune = true
# Write commit graph to speed up some repositories.
writeCommitGraph = true
[pull]
ff = only
[push]
default = simple
[merge]
# Include summaries of merged commits in newly created merge commit messages
log = true
# Use 3-way diffs.
conflictstyle = diff3
[rebase]
# Run `git stash` if needed before a `git rebase`
autoStash = true
# Auto-add `--autosquash` to `git rebase`
autoSquash = true
[rerere]
# Store and re-use manual conflict resolution changes.
enabled = true
# Automatically re-apply resolutions if seen again
autoupdate = true
[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
[color]
# Use colors in Git commands that are capable of colored output when outputting to the terminal
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
# URL shorthands
[url "git@github.com:"]
; insteadOf = https://github.com/
insteadOf = "gh:"
pushInsteadOf = "github:"
pushInsteadOf = "git://github.com/"
[url "git://github.com/"]
insteadOf = "github:"
[url "git@gist.github.com:"]
insteadOf = "gst:"
pushInsteadOf = "gist:"
pushInsteadOf = "git://gist.github.com/"
[url "git://gist.github.com/"]
insteadOf = "gist:"