-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitconfig
152 lines (129 loc) · 8.15 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
[include]
path = .gitconfig-work
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
[filter "remove-password"]
clean=bin/hooks/filter-password
[filter "remove-token"]
clean=bin/hooks/filter-token
[github]
user = novas0x2a
[sendemail]
suppressfrom = true
[merge]
tool = vimdiff
#ff = only
[svn]
rmdir = true
[rerere]
enabled = true
[alias]
# Console gitview replacement
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cd)%Creset' --abbrev-commit --date=relative
# Find the best name for the current branch
current-branch = !"f() { branch_name=$(git symbolic-ref -q HEAD); branch_name=${branch_name##refs/heads/}; branch_name=${branch_name:-HEAD}; echo $branch_name; }; f"
# Given a commit id, does an svn dcommit on that commit and parents. Doesn't use git checkout - because dcommit can change branches.
svn-push-cherry = !"f() { set -x; safe=__safe-$RANDOM; current=$(git current-branch); git svn rebase && git checkout -b $safe $1 && git svn dcommit && git checkout ${current} && git svn rebase && git branch -d $safe; set +x; }; f"
# Some short versions
s = status
ap = add -p
ri = rebase --interactive
# Show absolute top of repo
top = !"(cd \"`git rev-parse --git-dir`\" && cd .. && pwd)"
pruneall = !"f() { for remote in $(git remote); do echo \"pruning $remote\"; git remote prune $remote $*; done }; f"
# These svn ones don't work yet
## Get path to my externals file
#svn-ext-file = !"echo `git top`/.git/svn/my-externals.txt"
## Update one svn repo
#svn-ext-updateone = !"f() { dir=\"`git top`/$1\"; test -d $dir && svn update $dir || svn checkout $2 $dir; }; f"
## Run a script on every external
#svndo2 = !"f() { while read ext; do eval \"$1 $ext\" || return 1; done < `git svn-ext-file`; }; f"
#svndo = !"f() { while read ext; do path=`echo $ext | awk '{print $1}'`; set -x; $* ${path#/}; if [ $? -eq 0 ]; then set +x; else set +x; return 1; fi; done < `git svn-ext-file`; }; f"
## Update externals file
#svn-ext-new = !"f() { fn=`git svn-ext-file`; git svn show-externals | grep '^/' > $fn.2; test -f $fn && diff -u $fn $fn.2 || mv $fn.2 $fn; }; f"
# Update all externals
# svn-ext-update = !"f() { set -x; fn=`git svn-ext-file`; git svn show-externals | grep '^/' > $fn.2; if ! diff -q $fn $fn.2; then mv $fn.2 $fn; if ! git svndo git-svn-ext-updateone; then rm $fn; return 1; fi; fi; }; f"
# Doesn't work :(
# ignore = !"f() { for i in \"$@\"; do echo $(basename $i) >> $(dirname $i)/.gitignore; done; }; f"
# getdate = !"f() { a=$(git log --pretty='format:%ad' ${1}~1..${1} | head -n1); echo $a; }; f"
fromdate = !"f() { a=$(git log --all --pretty='format:%H' --until=\"@{${1}}\" | head -n1); echo $a; }; f"
pushv = !"f() { git push -vvvn \"$@\" && echo -n '\nok (y/N)? ' && read ok && test x\"$ok\" = 'xy' && echo git push -vvv \"$@\" || echo 'skipping push'; }; f"
date = log --pretty='format:%ad'
rebase-prep = !"f() { git rebase -i $(git merge-base HEAD $1); }; f"
prune-remote-helper = !"f() { git branch -a --merged ${2:+$2} | grep remotes/${1:?[\nusage: git prune-remote <remote> [branch]]}/ | cut -d / -f 3- | grep -v '^master$'; }; f"
prune-remote-pretend = !"f() { git prune-remote-helper $* | xargs git push --delete -n $1; }; f"
prune-remote = !"f() { git prune-remote-helper $* | xargs git push --delete $1; }; f"
review = !sh `git rev-parse --show-toplevel`/tools/rfc.sh
since-last-merge = !"f() { git log -p --reverse $(git merge-base ${1:?[git since-last-merge <oldbranch> <newbranch>} ${2:?[git since-last-merge <oldbranch> <newbranch>]})..$2; }; f"
oldbranches = for-each-ref --sort='-authordate' --format='%(authordate:iso8601) %(refname:short)' refs/heads
savage-sequence = !"f() { git test-sequence ${1:-piston/master}..${2:-HEAD} 'savage/install-packages.sh && savage/run_tests.py -1'; }; f"
savage-sequence-all = !"f() { git test-sequence ${1:-piston/master}..${2:-HEAD} 'savage/install-packages.sh && savage/run_tests.py'; }; f"
savage-sequence-all-lint = !"f() { git test-sequence ${1:-piston/master}..${2:-HEAD} 'savage/install-packages.sh && savage/run_tests.py && pylint --rcfile=savage/.pylintrc savage/savage savage/tests'; }; f"
savage-sequence-force = !"f() { git test-sequence --force ${1:-piston/master}..${2:-HEAD} 'savage/install-packages.sh && savage/run_tests.py -1'; }; f"
savage-sequence-lint = !"f() { git test-sequence ${1:-piston/master}..${2:-HEAD} 'savage/install-packages.sh && savage/run_tests.py -1 && pylint --rcfile=savage/.pylintrc savage/savage savage/tests'; }; f"
testit = !"f() { git savage-sequence-all-lint 2>&1 | tee savage/testit.log; }; f"
delete-merged-remotes = !"f() { OWNER=${1:-novas0x2a}; BRANCHES=$(git branch -r --merged ${2:-piston/master} | grep $OWNER | grep -v master | cut -d / -f 2- --output-delimiter=/); [[ -z $BRANCHES ]] && exit 0; echo git push --delete $OWNER $BRANCHES; read -p 'Okay? ' -n 1 -r; echo; if [[ -n $BRANCHES ]] && [[ $REPLY = y ]]; then git push --delete $OWNER $BRANCHES; fi; }; f"
maybe-merged = !"f() { PARENT=${1:-piston/master}; for branch in $(git for-each-ref --format='%(refname)' refs/heads | grep -v '/master$'); do if git cherry \"$PARENT\" \"$branch\" | grep -q '^-'; then echo \"$branch\"; fi; done; }; f"
subscribe-pulls-github = !"f() { REMOTE=${1:-origin}; if ! git config --local --get-all remote.${REMOTE}.fetch | grep -q refs/pull; then echo 'subscribing...' 2>&1; git config --local --add remote.${REMOTE}.fetch '+refs/pull/*/head:refs/remotes/pr/*'; fi; }; f"
subscribe-pulls-gitlab = !"f() { REMOTE=${1:-origin}; if ! git config --local --get-all remote.${REMOTE}.fetch | grep -q refs/pull; then echo 'subscribing...' 2>&1; git config --local --add remote.${REMOTE}.fetch '+refs/pull/*/merge-requests:refs/remotes/pr/*'; fi; }; f"
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%30s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'
gc-all = -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc --aggressive
who = !"f() { git blame --line-porcelain \"$1\" | grep '^author \\|author-mail ' | cut -d ' ' -f 2- | paste -d ' ' - - | sort | uniq -c | sort -nr; }; f"
mr = push -o merge_request.create
rc = rebase --continue
rp = !git rev-parse --verify origin/main >/dev/null && git pull --rebase origin main || git pull --rebase origin master
deepclean = !git reflog expire --expire=now --all && git gc --prune=now --aggressive
count-lines = "!git log --author=\"$1\" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\\n\", add, subs, loc }' #"
prune-local = !git --no-pager branch --list --format '%(if:equals=[gone])%(upstream:track)%(then)%(refname:short)%(end)' | xargs -n1 echo
prune-local-apply = "!git prune-local | xargs git branch -D"
prune-prs = !"git branch -r | grep pr/ | tr -d ' ' | sed -e 's,^,refs/remotes/,g' | xargs -n1 git update-ref -d"
[log]
date = local
[push]
default = simple
[core]
excludesfile = ~/.gitexcludes
[branch]
autosetuprebase = always
[gitreview]
username = novas0x2a
[diff]
algorithm = histogram
[gc]
reflogexpire = never
reflogexpireunreachable = never
auto = 0
[diff "sopsdiffer"]
textconv = sops -d
[credential]
#helper = cache --timeout 43200
helper = /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
[commit]
gpgsign = true
[transfer]
fsckobjects = false
[advice]
detachedHead = false
[url "git@github.com:"]
insteadOf = https://github.com/
[init]
defaultBranch = main
[fetch]
parallel = 0
[submodule]
fetchJobs = 0
[checkout]
workers = 0
[gpg]
format = ssh
[gpg "ssh"]
allowedSignersFile = /home/mlundy/.ssh/allowed_signers
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true