-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_gitconfig.tmpl
More file actions
57 lines (52 loc) · 2.78 KB
/
dot_gitconfig.tmpl
File metadata and controls
57 lines (52 loc) · 2.78 KB
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
[credential "https://github.com"]
helper =
helper = !{{ lookPath "gh" }} auth git-credential
[credential "https://gist.github.com"]
helper =
helper = !{{ lookPath "gh" }} auth git-credential
[credential]
helper = store
[core]
autocrlf = input
pager = delta
[init]
defaultBranch = main
[pull]
rebase = true
[interactive]
diffFilter = delta --color-only
# Diff tool for git, install with `git-delta`
[delta]
navigate = true
side-by-side = true
line-numbers = true
hyperlinks = true
light = false
[diff]
tool = nvimdiff
[merge]
conflictstyle = zdiff3
tool = nvimdiff
[help]
autocorrect = 20
[alias]
changes = "log -M -L"
fpush = push --force-with-lease
# Push a new branch, with some safety checks in case I forgot I'm not on a branch
do-push-branch = push -u origin HEAD
push-branch = "!master=$(git main-branch); if [ \"$(git symbolic-ref --short HEAD 2>/dev/null)\" = \"$master\" ]; then echo \"$master is not a branch\" 1>&2; exit 1; fi; git do-push-branch"
gpush = "!f() { remote=\"${1:-origin}\"; branch=\"${2:-master}\"; git push \"$remote\" \"HEAD:refs/for/$branch\"; }; f"
gfetch = "!f() { id=\"$1\"; remote=\"${2:-origin}\"; if [ -z \"$id\" ]; then echo 'Usage: git gfetch <change-id> [remote]' >&2; exit 1; fi; suffix=$(printf '%02d' $((id % 100))); ps=$(git ls-remote \"$remote\" \"refs/changes/$suffix/$id/*\" | sed 's|.*/||' | sort -n | tail -1); if [ -z \"$ps\" ]; then echo \"No patchsets found for change $id\" >&2; exit 1; fi; echo \"Fetching change $id patchset $ps\"; git fetch \"$remote\" \"refs/changes/$suffix/$id/$ps\" && git checkout FETCH_HEAD -b \"change-$id\"; }; f"
gclone = "!f() { server=\"$1\"; repo=\"$2\"; user=\"${3:-$USER}\"; if [ -z \"$server\" ] || [ -z \"$repo\" ]; then echo 'Usage: git gclone <server> <repo> [user]' >&2; exit 1; fi; if [ -z \"$user\" ]; then echo 'Error: username is empty. Set $USER or pass [user].' >&2; exit 1; fi; dir=\"${repo##*/}\"; dir=\"${dir%.git}\"; git clone \"https://$user@$server/a/$repo\" && (cd \"$dir\" && hook_dir=\"$(git rev-parse --git-dir)/hooks\" && mkdir -p \"$hook_dir\" && curl -fLo \"$hook_dir/commit-msg\" \"https://$server/tools/hooks/commit-msg\" && chmod +x \"$hook_dir/commit-msg\"); }; f"
ghook = "!f() { server=\"$1\"; if [ -z \"$server\" ]; then echo 'Usage: git ghook <server>' >&2; exit 1; fi; git_dir=$(git rev-parse --git-dir 2>/dev/null) || { echo 'Error: not inside a git repository.' >&2; exit 1; }; hook_dir=\"$git_dir/hooks\"; mkdir -p \"$hook_dir\" && curl -fLo \"$hook_dir/commit-msg\" \"https://$server/tools/hooks/commit-msg\" && chmod +x \"$hook_dir/commit-msg\"; }; f"
amend = commit --amend --no-edit
reword = commit --amend --only -v
undo = reset HEAD@{1}
[push]
autoSetupRemote = true
[fetch]
recurseSubmodules = on-demand
prune = true
[include]
path = ~/.gitconfig.local
# vim:ft=gitconfig