-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitconfig
206 lines (157 loc) · 6.04 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
[user]
name = Baur
email = github@streetmail.net
[alias]
s = !git status -sb
f = !git fetch origin --tags --prune && git s
b = !git branch -lv
br = !git branch -rv
st = !git add -A && git s
un = !git reset -q && git s
m = "!f(){ git commit -m \"$*\"; }; f"
mj = "!f(){ git commit -m \"$(git head | cut -c9-22): $*\"; }; f" # PROJECT-SPECIFIC
amn = !git commit --amend --no-edit
amm = !git commit --amend
head = !git rev-parse --abbrev-ref HEAD
prev = !git rev-parse --abbrev-ref @{-1}
relr = !git branch -r | grep origin | grep release/ | cut -c 3- | tail -1 # PROJECT-SPECIFIC
rell = !git branch -l | grep release/ | cut -c 3- | tail -1 # PROJECT-SPECIFIC
c = "!f(){ git checkout -q ${1}; git s; }; f"
co = "!f(){ git checkout --track origin/${1}; }; f"
cb = !git checkout -b
cp = !git checkout -q @{-1} && git s
cd = !git checkout -q develop && git s
cm = !git checkout -q main && git s
cr = !git checkout -q $(git rell) && git s # PROJECT-SPECIFIC
crr = !git checkout --track $(git relr) && git s # PROJECT-SPECIFIC
ct = !git checkout -B temp
ch = !git cherry-pick
chc = !git cherry-pick --continue
cha = !git cherry-pick --abort
ph = !git push -u origin HEAD
pf = !git push --force-with-lease
pa = !git push --all && git push --tags
db = !git cm && git branch -d $(git prev)
dbf = !git cm && git branch -D $(git prev)
dr = !git push origin --delete $(git head)
dm = !git branch --merged origin/main | egrep -v '(main|master|develop|release)' | xargs -n1 git branch -D
su = !git diff
ss = !git diff --staged
sa = !git diff HEAD
sf = !git diff HEAD --stat
mu = !git merge @{u} --no-ff --no-edit
mp = !git merge @{-1} --no-ff --no-edit
md = !git merge origin/develop --no-edit
mm = !git ffm && git merge main --no-edit
mr = !git merge $(git relr) --no-edit
mt = !git merge temp --no-edit
mc = !git merge --continue
ma = !git merge --abort
ru = !git rebase @{u}
rp = !git rebase @{-1}
rr = !git rebase $(git relr)
rm = !git rebase origin/main
rd = !git rebase origin/develop
rdt = !git rebase origin/develop -X theirs
rc = !git rebase --continue
ra = !git rebase --abort
ri = !git rebase -i
ff = !git merge @{u} --ff-only && git l1 && git s
fff = !git f && git ff
ffd = !git fetch . origin/develop:develop
ffm = !git fetch . origin/main:main
ffr = !git fetch . origin/$(git rell):$(git rell)
noff = !git merge --no-ff --no-edit
temp = !git add -A && git commit -m 'TEMP commit'
soft = !git reset --soft HEAD~1
hardu = !git reset --hard @{u} && git l1 && git s
me = !git config user.name && git config user.email
setme = !git config user.name 'Baur' && git config user.email 'github@streetmail.net'
or = !git config remote.origin.url
confl = !git config --edit --local
confg = !git config --edit --global
rem = !git remote -v
v = !git --version
cat = !git cat-file -p
time = !date +"%Y-%m-%d_%H-%M-%S"
lp = !git log --all --first-parent --pretty=format:\"%h - %<(20)%an | %<(14)%ar | %s\"
l = !git lp -1
l1 = !echo '\nLast 10 commits:' && git lp HEAD~10..HEAD
l2 = !echo '\nLast 11-20 commits:' && git lp HEAD~20..HEAD~11
l3 = !echo '\nLast 21-30 commits:' && git lp HEAD~30..HEAD~21
l4 = !echo '\nLast 31-40 commits:' && git lp HEAD~40..HEAD~31
l5 = !echo '\nLast 41-50 commits:' && git lp HEAD~50..HEAD~41
lu = !git lp HEAD..@{u}
ll = !git lp @{u}..HEAD
lf = !git lp --follow
la = "!f(){ git lp -20 --all --author=\"${1-Baur}\"; }; f"
lm = "!f(){ git lp --grep \"${1-strange}\"; }; f"
lw = "!f(){ git lp --author=\"$(git config user.name)\" --all --since='1 week ago'; }; f"
# SCRIPTS
back = "!f(){ \
name=$(git head)-backup/$(git time);\
git branch $name;\
echo $name;\
}; f"
copy = "!f(){ git merge $(git commit-tree ${1}^{tree} -p HEAD -m \"Tree copy from ${1}\"); }; f"
com = "!f(){ \
left=${1:-origin/main};\
right=${2:-$(git head)};\
read leftCount rightCount <<< $(git rev-list --left-right --count $left...$right); echo;\
echo "[$left] contains $leftCount unique commits" ;\
echo "[$right] contains $rightCount unique commits" ;\
if [[ $leftCount > 0 && $rightCount == 0 ]]; then echo "[$right] is parent for [$left]";\
elif [[ $leftCount == 0 && $rightCount > 0 ]]; then echo "[$left] is parent for [$right]";\
else echo "they dont refer one another"; fi;\
}; f"
rvm = !sh ~/github/git-rebase-via-merge/git-rebase-via-merge.sh
debug = "!GIT_TRACE=2; GIT_CURL_VERBOSE=2; GIT_TRACE_PERFORMANCE=2; GIT_TRACE_PACK_ACCESS=2; GIT_TRACE_PACKET=2; GIT_TRACE_PACKFILE=2; GIT_TRACE_SETUP=2; GIT_TRACE_SHALLOW=2; git"
al = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/'
# https://stackoverflow.com/a/39616600/985457
quote-string = "!read -r l; printf \\\"!; printf %s \"$l\" | sed 's/\\([\\\"]\\)/\\\\\\1/g'; printf \" #\\\"\\n\" #"
quote-string-undo = "!read -r l; printf %s \"$l\" | sed 's/\\\\\\([\\\"]\\)/\\1/g'; printf \"\\n\" #"
[core]
editor = vim
whitespace = -trailing-space,-indent-with-non-tab,-tab-in-indent
eol = lf
autocrlf = false
[credential]
helper = manager
modalPrompt = false
[color]
ui = auto
[gc]
auto = 0
[pull]
ff = only
[push]
default = upstream
followTags = true
[rebase]
# autosquash = true
[merge]
tool = vimdiff
conflictstyle = diff3
[mergetool]
prompt = true
[diff]
tool = vimdiff
mnemonicPrefix = true
renames = true
[difftool]
prompt = true
[log]
abbrevCommit = true
follow = true
[rerere]
enabled = 0
# https://git-scm.com/docs/git-config
# examples
# https://gist.github.com/tdd/470582
# https://gist.github.com/pksunkara/988716
# https://gist.github.com/robmiller/6018582
# creating a symlink on mac/linux
# ln -s ~/github/my-git-config/.gitconfig ~/.gitconfig
# creating a symlink on windows (in cmd as admin)
# rename %UserProfile%\.gitconfig .gitconfig_backup
# mklink %UserProfile%\.gitconfig c:\github\my-git-config\.gitconfig