/
gitconfig
162 lines (153 loc) · 5.34 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
# vim: syntax=gitconfig
[user]
name = Colin Dean
#set email in .gitconfig.local
[include]
path = .gitconfig.local
[color]
diff = auto
status = auto
branch = auto
interactive = auto
[core]
whitespace = trailing-space,space-before-tab
excludesfile = ~/.gitignore_global
autocrlf = input
pager = delta
attributesfile = ~/.gitattributes
[interactive]
diffFilter = delta --color-only
[diff]
renames = copies
colorMoved = default
[merge]
conflictstyle = diff3
[delta]
navigate = true
features = zenburn
[rerere]
enabled = true
[alias]
# Better logging
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lsum = log --color --pretty=format:'%s %Cgreen(%cr) %Creset' --abbrev-commit #--not --grep 'maven-release-plugin'
lsince = log --oneline --not --grep '^Merge pull request' --grep '^Merge branch'
log1 = log --pretty=oneline --abbrev-commit
last = log -1 HEAD --format=format:"%Cred%H" # get the full hash of the HEAD commit
graph = log --graph -10 --branches --remotes --tags --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %ar) %Cred%d' --date-order
history = log -10 --format=format:'%Cgreen%h %Creset• %s (%cN, %ar)'
# Analytics
author-count-commit = !git log --format="%aE" $@ | tr "[:upper:]" "[:lower:]" | sort | uniq -c | sort -nr
author-count-lines = !git ls-files -z | xargs -0n1 git blame --line-porcelain | grep '^author-mail' | cut -d ' ' -f 2 | tr "[:upper:]" "[:lower:]" | sort | uniq -c | sort -rn
contributors = shortlog -s -n # list contributors by number of commits
filetrail = log --follow -p -w # show commits made to a file over time
mergetrail = log --ancestry-path --merges
bigfiles = !git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort --numeric-sort --key=2 | tail -n 10 | cut -c 2-12,41- | $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
# Changes
summary = status -u -s
amend = commit --amend
## Mark removed files as deleted, and new files as added
addremove = !git add . && git ls-files --deleted | xargs git rm
save = commit -m
resave = commit --amend
unmerged = diff --name-only --diff-filter=U
prestage = diff -w --word-diff=color # show unstaged changes
precommit = diff --cached -w --word-diff=color --word-diff-regex='[^[:space:]<>]+' # show staged changes
unstash = stash pop
untrack = rm -r --cached
# Searching
grep = grep --line-number --color
# Branches
sw = switch
unmerged = branch --no-merged
back = checkout "-"
current-branch = symbolic-ref --short -q HEAD
cleanup = !git branch --merged | grep -v '\\*\\|master\\|develop' | xargs -n 1 git branch -d
unstage = reset -q HEAD --
discard = checkout --
nevermind = !git reset --hard HEAD && git clean -d -f # clean the repo to pristine
uncommit = reset --mixed HEAD~
## Delete local branches also gone from the origin (pass in -D to force-delete)
cleanup-gone-branches = "!f() { git fetch -p && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch ${1:--d}; }; f"
# Releases
semtag = !git tag -a $(semver tag) -m \"tagging $(semver tag)\"
# Pushing
pupr = !git push -u origin HEAD && hub pull-request -o
fpush = !git push --force-with-lease
puoh = !git push -u origin HEAD
# Et cetera
## Print URLs of remote repositories. (git config --get-regex '^remote' is a simpler command, but its output isn’t aligned.)
remote-paths = "!grep -A2 '^\\[remote' $(git root)/.git/config"
## All files under version control in the current revision
manifest = ls-tree -r --full-tree --name-only HEAD
## Create default .git-blame-ignore-revs file from revs that contain "Reformat"
#write-reformats-to-blame-ignore = !git log --grep Reformat --format="%H%n\0x23 %s" >> .git-blame-ignore-revs
set-blame-ignore-revs = config set blame.ignoreRevsFile .git-blame-ignore-revs
# Misspellings, Plurals, etc.
ad = add
ass = add
dff = diff
doff = diff
emrge = merge
idff = diff
mergfe = merge
mregetool = mergetool
mt = mergetool
oull = pull
pish = push
pl = pull
ps = push
psuh = push
pu = up
puhs = push
puosh = push
pus = push
pushy = push
reabse = rebase
satsh = stash
sst = status -sb
t = status -sb
tint = init
tpull = pull
tpush = push
ts = status -sb
tst = status -sb
tup = up
move = mv
remove = rm
## Plurals
tags = tag
branches = branch -a
stashes = stash list
remotes = remote -v
## Utilties
master-to-main = !git checkout master && git branch -m master main && git fetch && git branch --unset-upstream && git branch -u origin/main && git remote set-head origin -a
[push]
default = simple
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
process = git-lfs filter-process
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[pull]
ff = only
[init]
defaultBranch = main
[url "git@github.com:colindean"]
insteadof = https://github.com/colindean
[url "git@gitlab.com:colindean"]
insteadof = https://gitlab.com/colindean
[github]
user = colindean
# Sources:
# https://github.com/gggritso/dotfiles/blob/master/gitconfig.symlink
[blame]
markIgnoredLines = true
markUnblamableLines = true
[safe]
directory = /vela/mosaic-ml-models-extended-service-plan