-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_gitconfig.tmpl
155 lines (155 loc) · 4.93 KB
/
dot_gitconfig.tmpl
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
[user]
name = Matt Loberg
email = {{ .email }}
signingkey = {{ .signingKey }}
[credential]
helper = {{ if eq .chezmoi.os "darwin" }}osxkeychain{{ else }}cache{{ end }}
[gpg]
{{- if eq (printf "%.3s" .signingKey) "ssh" }}
format = ssh
{{- else }}
program = gpg
{{- end }}
[gpg "ssh"]
allowedSignersFile = ~/.ssh/allowed_signers
[commit]
gpgsign = true
[tag]
gpgsign = true
[alias]
c = !{{ if lookPath "art" }}art commit{{ else }}cz{{ end }}
co = switch
pf = push --force-with-lease
tags = tag -l
branches = branch -a
remotes = remote -v
# List aliases
aliases = "!git config --get-regexp 'alias.*' | sed 's/alias\\.//' | sed 's/[ ]/ = /' | sort | ${PAGER:-less}"
alias = "!f() { git aliases | grep -e \"$1\" | ${PAGER:-less}; }; f"
# List contributors by number of commits
contributors = shortlog -sn
# See what's staged
staged = diff --staged
# Show log of commits that haven't been pushed yet
unpushed = log @{u}..
# Show diff of changes that haven't been pushed yet
changes = "!git diff origin/$(git rev-parse --abbrev-ref HEAD)..HEAD"
# Amend the last commit
amend = commit --amend -C HEAD
# Change message of last commit
reword = commit --amend
# Undo the last commit, but keep the changes
undo = reset --soft HEAD^
# Create new branch
new = switch -c
# Rename the current branch
rename = branch -m
# Unstage a file
unstage = restore --staged
# Publish the current branch to the remote
publish = "!f() { git push --set-upstream ${1:-origin}; }; f"
# Delete a branch on the remote
unpublish = "!f() { git push ${2:-origin} --delete $1; }; f"
# Delete a branch locally and on the origin remote
nuke = "!f() { git unpublish $1; git branch -D $1; }; f"
# Show merged branches
merged = "!git branch --merged | grep -vE '\\*|master|main|develop'"
# Credit the author of the last commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f"
# Interactive rebase of commits that haven't been pushed yet
wip = rebase -i @{u}
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r"
# Squash the current branch (for merge request) (git squash main origin)
squash = "!s() { git fetch; git rebase -i ${2:-origin}/${1:-main}; }; s"
# Rebase with upsream main branch
sync = "!s() { git fetch; git rebase ${2:-origin}/${1:-main}; }; s"
# Show summary of commits
summary = log --name-status
# Bisect shortcut. Assumes the bad commit is HEAD
bs = "!b() { git bisect start ${2:-HEAD} ${1}; }; b"
# Lock files (ignore changes)
lock = update-index --skip-worktree
locked = "!l() { git ls-files -v | grep "^S" | sed -e 's|S ||'; }; l"
unlock = update-index --no-skip-worktree
# Show diff of last stash
stashed = stash show -p
# List authors
authors = shortlog --summary --numbered --email
# Create pull requests with GitHub's CLI
pr = "!op plugin run -- gh pr create -w"
# Checkout pull request
cpr = "!op plugin run -- gh co"
# Clone repo
repo = "!op plugin run -- gh clone"
# Open repo in web browser
web = "!op plugin run -- gh repo view --web"
# Re-commit using the same commit message
recommit = commit -c ORIG_HEAD
[apply]
whitespace = nowarn
[color]
diff = auto
status = auto
branch = auto
ui = true
[core]
excludesfile = ~/.gitignore
editor = vim
pager = delta
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on macOS
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
trustctime = false
# Prevent showing files whose names contain non-ASCII symbols as unversioned.
# http://michael-kuehnel.de/git/2014/11/21/git-mac-osx-and-german-umlaute.html
precomposeunicode = false
[interactive]
diffFilter = delta --color-only --features=interactive
[diff]
colorMoved = default
[difftool]
prompt = false
[fetch]
prune = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[help]
autocorrect = 1
[init]
defaultBranch = main
[merge]
ff = only
conflictstyle = diff3
[mergetool]
keepBackup = false
[pull]
rebase = true
[push]
default = current
followTags = true
[rebase]
autoStash = true
[delta]
features = side-by-side line-numbers decorations
syntax-theme = Nord
plus-style = syntax "#003800"
minus-style = syntax "#3f0001"
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
hunk-header-decoration-style = cyan box ul
[delta "line-numbers"]
line-numbers-left-style = cyan
line-numbers-right-style = cyan
line-numbers-minus-style = 124
line-numbers-plus-style = 28
[include]
path = ~/.gitconfig.local