-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
193 lines (181 loc) · 10 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
[diff]
tool = Kaleidoscope
[difftool]
prompt = false
[mergetool]
keepBackup = false
prompt = false
[merge]
keepBackup = false
tool = Kaleidoscope
conflictstyle = diff3
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustexitcode = true
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[alias]
lg = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
cl = clone
ai = add --interactive
authors = !git shortlog -s -n -e
# this is the number of commits in branch, use this on main branch to generate a
# build number for XCode release builds
# All the aliases relate to commits. Note that
# they are grouped by common prefixes, so I don't
# confuse what I want done by accident.
c = commit
uncommit = "reset HEAD~"
# https://preslav.me/2020/03/01/use-the-git-history/
code-changes = "!git log --format=format: --name-only | egrep -v '^$' | sort | uniq -c | sort -rg | head -10"
cc = "!git code-changes"
# commit with a message
cm = commit -m
# cma = commit -a -m
# amending the previous commit
# camd = commit --amend
#caa = commit -a --amend -C HEAD
# shortcuts for commands
ss = status
s = status -s
d = !git diff --name-only \
| fzf --no-sort --reverse \
--preview 'git diff --color=always {} | diff-so-fancy' \
--bind 'ctrl-j:down,ctrl-k:up,ctrl-e:preview-down+preview-down+preview-down,ctrl-y:preview-up+preview-up+preview-up,ctrl-u:preview-page-up,ctrl-d:preview-page-down' \
--preview-window=right,70%
ds = !git diff --name-only --cached \
| fzf --no-sort --reverse \
--preview 'git diff --staged --color=always {} | diff-so-fancy' \
--bind 'ctrl-j:down,ctrl-k:up,ctrl-u:preview-page-up,ctrl-d:preview-page-down' \
--preview-window=right,70%
df = diff --color --color-words --abbrev
dt = difftool
a = add
co = checkout
b = branch
l = log
f = fetch
fix = "!f(){ msg=$1; hyphenated_branch=${msg// /-}; branch=$(echo \"${hyphenated_branch}\" | tr [:upper:] [:lower:]); git checkout -b fix/${branch}; git add --all; git commit -m \"fix: ${msg}\"; git checkout main; git merge fix/${branch}; }; f"
rb = rebase
r = reset
# merging
m = merge
mt = mergetool
# pretty git log
lol = log --graph --decorate --pretty=oneline --abbrev-commit
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
ll = lol -3
# pd = !/Users/benwoodward/dev/pretty-diff/pretty-diff.js
# gd = !/Users/benwoodward/dev/pretty-diff/gist-diff.js
# ctags = !.git/hooks/ctags
g = grep --break --heading --line-number
# deletes any local branches that have been merged into current HEAD
# cleanup = !git branch --merged | grep -v '^* master$' | grep -v '^ master$' | xargs git branch -d
cleanup = !git branch --merged | grep -v '\\*' | grep -v master | grep -v main | grep -v dev | grep -v develop | xargs -n 1 git branch -d
ctags = !.git/hooks/ctags\n
bn = !git rev-list HEAD | wc -l | tr -d ' '
browse = "!f(){ open `git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@'`| head -n1; }; f"
# list files which have changed since REVIEW_BASE
# (REVIEW_BASE defaults to 'master' in my zshrc)
#
# Review between 'gh-pages' and the current branch
# REVIEW_BASE=gh-pages git stat
#
# Review changes made by the last commit of this branch:
# REVIEW_BASE=HEAD^ git stat
files = !git diff --name-only $(git merge-base HEAD \"$REVIEW_BASE\")
review = !nvim +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
# Same as above, but with a diff stat instead of just names
# (better for interactive use)
pr-stat = !git diff --stat main $(git rev-parse --abbrev-ref HEAD)
hm = !git heatmap -b main -n 30 --filter 'grep -v \"package\"'
fl = !" \
function gfzf() { \
local filter; \
if [ -n $@ ] && [ -e $@ ]; then \
filter=\"-- $@\"; \
fi; \
export LESS='-R' \
export BAT_PAGER='less -S -R -M -i'; \
git log \
--graph --color=always --abbrev=7 \
--format=format:\"%C(bold blue)%h%C(reset) %C(dim white)%an%C(reset)%C(bold yellow)%d%C(reset) %C(white)%s%C(reset) %C(bold green)(%ar)%C(reset)\" $@ | \
fzf --ansi --no-sort --layout=reverse --tiebreak=index \
--preview=\"f() { set -- \\$(echo -- \\$@ | rg -o '\\b[a-f0-9]{7,}\\b'); [ \\$# -eq 0 ] || git show --color=always \\$1 $filter | delta --line-numbers; }; f {}\" \
--bind=\"ctrl-m:execute: \
(rg -o '\\b[a-f0-9]{7,}\\b' | head -1 | \
xargs -I % -- git show --color=always %) << FZFEOF\n \
{} \
\nFZFEOF\" \
--bind=\"ctrl-c:execute-silent: \
(rg -o '\\b[a-f0-9]{7,}\\b' | head -1 | tr -d \\$'\\n' | clipboard) << FZFEOF\n \
{} \
\nFZFEOF\" \
--preview-window=right:60%; \
}; \
gfzf \
"
[push]
default = current
[web]
browser = open
[user]
name = Ben Woodward
email = [email protected]
[github]
user = benwoodward
[core]
# editor = mvim -f --nomru -c \"au VimLeave * !open -a iTerm\"
editor = subl -n -w
excludesfile = ~/.gitignore
quotepath = false
pager = diff-so-fancy | less --tabs=1,5 -R
[credential]
helper = osxkeychain
[grep]
lineNumber = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git lfs smudge %f
required = true
process = git-lfs filter-process
[init]
templatedir = /Users/ben/.git-templates
defaultBranch = main
[fetch]
; templatedir = ~/.git_template
prune = true
[http]
cookiefile = ~/.gitcookies
[diff-so-fancy]
markEmptyLines = true
stripLeadingSymbols = true
changeHunkIndicators = false
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = always
pager = true
[interactive]
diffFilter = delta --color-only --line-numbers
[delta]
dark = true
file-style = omit
hunk-header-decoration-style = omit
hunk-header-file-style = magenta
hunk-header-line-number-style = dim magenta
hunk-header-style = file line-number syntax
line-numbers = false
minus-emph-style = bold red 52
minus-empty-line-marker-style = normal "#3f0001"
minus-non-emph-style = dim red
minus-style = bold red
plus-emph-style = bold green 22
plus-empty-line-marker-style = normal "#002800"
plus-non-emph-style = dim green
plus-style = bold green
syntax-theme = OneHalfDark
whitespace-error-style = reverse red
zero-style = dim syntax