-
Notifications
You must be signed in to change notification settings - Fork 4
/
dot_gitconfig.tmpl
155 lines (127 loc) · 4.22 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
# lots of ideas taken from
# https://gist.github.com/pksunkara/988716
[user]
name = {{ .git_user }}
email = {{ .email }}
[alias]
c = clone
d = diff
ds = diff --staged
dt = difftool
co = checkout
s = switch
ci = commit
st = status
stn = status -uno
br = branch
m = merge
ma = merge --abort
# merge from upstream, if we git --fetch first
# HEAD - get branch name
# branch_name@{u} - get upstream tracking (e.g. origin/main
merge-upstream = !UPSTREAM=$(git rev-parse --abbrev-ref $(git rev-parse --abbrev-ref HEAD)@{u}) && git merge --ff-only "$UPSTREAM"
rc = rebase --continue
ra = rebase --abort
rs = rebase --skip
p = pull
pr = pull --rebase
rv = remote -v
# unstaged staged changes, but don't remove them (use --worktree,-W for that)
rH = restore --staged
cp = cherry-pick
cpa = cherry-pick --abort
cpc = cherry-pick --continue
stp = stash push
sta = stash apply
std = stash drop
stl = stash list
sf = submodule foreach
short = rev-parse --short HEAD
# nicely formatted history (includes all branches)
hist = log --graph --abbrev-commit --decorate --all --date=short \
--format=format:'%C(bold blue)%h%C(reset) %C(bold cyan)%ad%C(reset) | %C(white)%s%C(reset) %C(dim green)[%an]%C(reset) %C(bold yellow)%d%C(reset)'
# history of specific branch
histb = log --graph --abbrev-commit --decorate \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim green)[%an]%C(reset)'
# longer format for really looking through history
histl = log --graph --abbrev-commit --decorate --all \
--format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim green)[%an]%C(reset)%n'
# for diffing commits between two branches - don't want `--all` (like `hist` has)
db = log --graph --abbrev-commit --decorate --date=short \
--format=format:'%C(bold blue)%h%C(reset) %C(bold cyan)%ad%C(reset) | %C(white)%s%C(reset) %C(dim green)[%an]%C(reset) %C(bold yellow)%d%C(reset)'
# gitlab: get merge requests
# (using `gh` for github)
lab-mr = !sh -c 'git fetch $1 merge-requests/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
# hub-mr = !sh -c 'git fetch $1 pull/$2/head:mr-$1-$2 && git checkout mr-$1-$2' -
# empty commit - sometimes useful for testing CI
fake = commit --allow-empty -m 'empty commit'
# only use an ignore-revs-file when i want to
bblame = blame --ignore-revs-file .git-blame-ignore-revs
[core]
editor = nvim
excludesfile = ~/.gitignore_global
pager = less --redraw-on-quit
# problem here:
# using `less -FX` turns to cat for onepage input (-F), and doesn't send termcap deinit (-X)
# however, the lack of termcap init (-X) means you cant scroll w/ mouse on longer pages
# changing to `less -F` sends termcap deinit which clears the page (useless) :/
# so either you can scroll on long input, or you keep results around for short bois
[color "branch"]
current = yellow bold
local = green bold
remote = cyan bold
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "status"]
added = green bold
changed = yellow bold
untracked = red bold
[pager]
stash = false
#diff = diff-so-fancy | less --tabs=4 -R
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[diff]
# AST-based diff tool.
# tool = diffsitter
# AST-based diff tool, that seems a bit more robust.
tool = difftastic
submodule = log
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[difftool "diffsitter"]
cmd = diffsitter --color=on "$LOCAL" "$REMOTE"
[difftool "nvim"]
cmd = nvim -d "$LOCAL" "$REMOTE"
[pull]
ff = only
[init]
defaultBranch = main
[rerere]
enabled = true
[rebase]
autoStash = true
[merge]
conflictStyle = zdiff3
[blame]
# is there a way to fallback??
# ignoreRevsFile = .git-blame-ignore-revs
# mark skipped commits with '?'
markIgnoredLines = true
# mark skipped unattributable lines with '*'
markUnblamableLines = true
coloring = highlightRecent