-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
181 lines (155 loc) · 6.07 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
[user]
name = Aaron Meurer
email = asmeurer@gmail.com
# For Secretive, this should be a symlink to the signing key
signingkey = ~/.ssh/ssh_signing.pub
[color]
diff = auto
status = auto
branch = auto
interactive = true
[color "diff"]
new = white
[alias]
ci = commit --interactive
di = diff --color-words
st = status
# Automatically checkout username:branch as copied from GitHub
co = "!bash -c ': git branch ; if [ \"$#\" -eq 1 ] && echo \"$1\" | grep -qE \"^[^/:]+:.+\\$\"; then IFS=: read -r remote branch <<<\"$1\"; origin_url=$(git remote get-url origin); repo_name=$(basename -s .git \"$origin_url\"); git remote get-url \"$remote\" 2>/dev/null || git remote add \"$remote\" \"git@github.com:$remote/$repo_name.git\"; if git fetch \"$remote\" \"$branch\"; then local_branch=\"${remote}-${branch//\\//-}\"; git show-ref --verify --quiet \"refs/heads/$local_branch\" && git checkout \"$local_branch\" || git checkout -b \"$local_branch\" \"$remote/$branch\"; else echo \"Error: Remote branch $remote:$branch not found.\"; fi; else git checkout \"$@\"; fi' -"
# Push the current branch. If remote is not set, set and track to github.
pu = "!: git branch ; f() {\\\n branch=\"$(git rev-parse --abbrev-ref HEAD)\"; \\\n remote=\"$(git config --get branch.$branch.remote)\"; \\\n if [ -z \"$remote\" ]; then \\\n git push -u github \"$branch\" \"${@}\"; \\\n else \\\n git push \"$remote\" \"$branch\" \"${@}\"; \\\n fi; \\\n}; f"
gh-diff = "!f() { \
if [ $# -eq 0 ] || [ $# -gt 2 ]; then \
echo \"Usage: git gh-diff [<base>] <compare>\"; \
return 1; \
fi; \
if [ $# -eq 1 ]; then \
base=$1; \
compare=$(git rev-parse --abbrev-ref HEAD); \
else \
base=$1; \
compare=$2; \
fi; \
remote=$(git remote get-url origin); \
if [[ $remote != *github.com* ]]; then \
echo \"This repository is not hosted on GitHub.\"; \
return 1; \
fi; \
base_remote=$(git config branch.$base.remote || echo \"origin\"); \
compare_remote=$(git config branch.$compare.remote || echo \"origin\"); \
base_repo=$(git remote get-url $base_remote | sed -e 's/.*github.com[:\\/]//; s/\\.git$//'); \
compare_repo=$(git remote get-url $compare_remote | sed -e 's/.*github.com[:\\/]//; s/\\.git$//'); \
if [ \"$base_repo\" = \"$compare_repo\" ]; then \
url=\"https://github.com/$base_repo/compare/$base...$compare\"; \
else \
base_user=$(echo $base_repo | cut -d'/' -f1); \
compare_user=$(echo $compare_repo | cut -d'/' -f1); \
repo_name=$(echo $base_repo | cut -d'/' -f2); \
url=\"https://github.com/$base_user/$repo_name/compare/$base_user:$base...$compare_user:$compare\"; \
fi; \
case \"$(uname -s)\" in \
Linux*) xdg-open $url ;; \
Darwin*) open $url ;; \
CYGWIN*|MINGW32*|MSYS*|MINGW*) start $url ;; \
*) echo \"Unsupported operating system. Please open the following URL manually:\"; \
echo $url ;; \
esac; \
}; f"
pu-all = push github :
logl = log --pretty=oneline --abbrev-commit
gr = grep -i --color -n -E --no-recurse-submodules
# See bin/git-backup.sh
backup = !git-backup.sh
backups = !git fsck --unreachable | grep commit | cut -d' ' -f3 | xargs git log --merges --no-walk --grep='Backup Commit' --stat
back = backup
fe = fetch --all
weekreport = shortlog --since=1.weeks --author=asmeurer
dayreport = shortlog --since=1.days --author=asmeurer
br = branch
detach = !git checkout $(git rev-parse HEAD)
bl = blame -CCC -M
lg = log --graph --topo-order --use-mailmap --stat --decorate
sw = show --color-words
psh = !git pull --no-edit && git push
com = commit
pusho = push --set-upstream origin HEAD
reset--hard = !git backup && git reset --hard
res--hard = !git backup && git reset --hard
masteralias = symbolic-ref refs/heads/master refs/heads/main
mainalias = symbolic-ref refs/heads/main refs/heads/master
# Typos
dif = diff
difff = diff
iff = diff
idff = diff
DIFF = diff
dff = diff
fif = diff
diif = diff
pul = pull
pulll = pull
tpull = pull
shwo = show
how = show
[branch]
# Sort most recent branches to the end
sort = committerdate
[i18n]
commitEncoding = utf-8
[push]
default = tracking
[github]
user = asmeurer
[rerere]
enabled = true
[credential]
helper = osxkeychain
[core]
precomposeunicode = true
[blame]
coloring = repeatedLines
[pager]
log = ~/Documents/git/contrib/diff-highlight/diff-highlight | less
show = ~/Documents/git/contrib/diff-highlight/diff-highlight | less
diff = ~/Documents/git/contrib/diff-highlight/diff-highlight | less
branch = false
tag = false
[interactive]
diffFilter = ~/Documents/git/contrib/diff-highlight/diff-highlight
singleKey = true
[commit]
gpgSign = true
[tag]
forceSignAnnotated = true
# Makes git fetch all PRs from GitHub. Not actually a good idea to do this
# globally, but can be a good idea for some specific repos.
# [remote "origin"]
# fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
# https://www.reddit.com/r/emacs/comments/4j4rle/i_figure_it_out_how_to_use_emacsclient_as_gits/
# [merge]
# tool = emacsclient
[mergetool "emacsclient"]
cmd = emacsclient -nw -c -a \"\" --eval \"(my/emerge \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" \\\"$OUTPUT\\\")\"
keepBackup = false
[mergetool]
keepBackup = false
[pull]
rebase = false
[stash]
showPatch = true
[help]
autoCorrect = prompt
[submodule]
recurse = true
[fetch]
parallel = 0
[gpg]
format = ssh
[gpg "ssh"]
# See https://docs.gitlab.com/ee/user/project/repository/signed_commits/ssh.html#verify-commits-locally
allowedSignersFile = ~/.ssh/allowed_signers