-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
150 lines (119 loc) · 4.92 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
[include]
# this file is not in yadm, so can contain config i don't want shared between machines
path = .gitconfig.local
[alias]
# fetch and checkout a MR.
# use like `git mr mr-number` or `git mr remote mr-number` - e.g. `git mr origin 4`
mr = !sh -c 'test -z $2 && REMOTE="origin" || REMOTE=$1 && git fetch $REMOTE merge-requests/$2/head:mr-${REMOTE}-$2 && git checkout mr-${REMOTE}-$2' -
st = status -s
wt = worktree
wta = worktree add
wtr = worktree remove
wtl = worktree list
# add and commit everything.
ca = !git add -A && git commit -av
cap = !git add -A && git commit -av && git publish
co = checkout
com = "!f() { git checkout $(git main-branch); }; f 2>/dev/null"
# really stash everything
stash-all = stash save --include-untracked
# better format for git log.
glog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
# show the diff between the last commit and the current state
d = "!f() { git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat; }; f"
# switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f"
gom = "!f() { git checkout -b \"$1\" $(git main-branch) 2> /dev/null || git checkout \"$1\"; }; f"
# list aliases
aliases = config --get-regexp alias
# amend the currently staged files to the latest commit
amend = commit --amend --reuse-message=HEAD
# update commit message on latest commit
reword = commit --amend
# Show verbose output about tags, branches or remotes
tags = tag -l
branches = branch -a
remotes = remote -v
# remove old tag with this name and tag latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1 && git push origin --tags ;}; r"
delete-merged = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
# list contributors with number of commits
contributors = shortlog --summary --numbered
# makes more sense
publish = "!branchname=$(git rev-parse --abbrev-ref HEAD); git push -u origin $branchname"
# see which remote we're tracking
show-remote = rev-parse --abbrev-ref --symbolic-full-name @{u}
## from kbd/setup on github
commit-info = show --no-patch --date=short --format='%S%x00%C(green)%ad%C(reset) %C(magenta)%C(italic)%<(40,trunc)%S%C(reset) %C(auto)%h %C(blue)%<(15,trunc)%an %C(auto)%<(65,trunc)%s%D%C(reset)'
fp = push --force-with-lease
## from https://github.com/ahmetsait/toolgit/ (more or less)
main-branch = "!f() { git rev-parse --verify --quiet --abbrev-ref origin/HEAD | cut -d'/' -f2 ; }; f"
is-worktree-clean = "!f() { status=$(git status --porcelain); success=$? ; [[ -z "$status" ]] && exit 0 || exit 1 ;}; f"
[apply]
# detect whitespace errors when applying a patch
whitespace = fix
[core]
autocrlf = input
# 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
# speed up commands involving untracked files (e.g. `git status`)
untrackedCache = true
[diff]
# detect copies as well as renames
renames = copies
colorMoved = default
colorMovedWS = "allow-indentation-change"
tool = nvimdiff
[diff "bin"]
# use `hexdump` to diff binary files
textconv = hexdump -v -C
[help]
# autocorrect and execute mistyped commands
autocorrect = 1
[merge]
# include summaries of merged commits in newly created merge commit messages
log = true
conflictstyle = zdiff3
tool = nvimdiff
[push]
# make `git push` push relevant annotated tags when pushing branches out.
followTags = true
# should work like my publish alias
default = current
autoSetupRemote = true
[pull]
rebase = false
[branch]
autosetupmerge = always
[init]
defaultBranch = main
[commit]
verbose = 2
template = ~/.config/git/commit-template
[rebase]
# automatically force-update any branches that point to commits that are being rebased.
updateRefs = true
# REuse REcorded REsolution -- makes repetitive rebases or cherry-picks less painful
[rerere]
enabled = true
autoUpdate = true
[fetch]
prune = true
[delta]
features = decorations
navigate = true
syntax-theme = OneHalfDark
[delta "decorations"]
commit-decoration-style = blue ol
commit-style = raw
file-style = omit
hunk-header-decoration-style = blue box
hunk-header-file-style = red
hunk-header-line-number-style = "#067a00"
hunk-header-style = file line-number syntax
[delta "interactive"]
keep-plus-minus-markers = false
[interactive]
diffFilter = delta --color-only --features=interactive