-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitconfig
119 lines (105 loc) · 5.21 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
[hub]
protocol = https
[user]
helper = osxkeychain
name = Bruno Pinto
email = [email protected]
signingkey = [email protected]
[alias]
ctags = !.git/hooks/ctags
ds = diff --staged
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
lga = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
ll = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --decorate --numstat
lla = log --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --decorate --numstat
patch = diff --no-color
pf = push --force-with-lease
pr = pull --rebase
smart-blame = blame -W -C -C -C
st = status -sb
# Amend the currently staged files to the latest commit
amend = commit --amend -C HEAD
# Interactive checkout
co = "!f() { [ $# != 0 ] && git checkout $@ || git checkout $(git branch | grep -v '^*' | fzf --preview 'git show --color $(git merge-base main {+1})..{+1}'); }; f"
# List contributors with number of commits
contributors = shortlog --summary --numbered
# Credit an author on the latest commit
credit = "!git shortlog --email --numbered --summary | fzf --reverse --delimiter='\t' --bind 'enter:execute(git commit --amend --author \"{+2}\" -C HEAD)+accept'"
# Remove branches that have already been merged with main
# a.k.a. ‘delete merged’
;dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d; git remote -v update -p"
# Remove branches that have already been "squash-merged" into main
# a.k.a 'delete squashed'
dm = "!git for-each-ref refs/heads/ '--format=%(refname:short)' | while read branch; do mergeBase=$(git merge-base main $branch) && [[ $(git cherry main $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == '-'* ]] && git branch -D $branch; done"
# Interactive fixup
fixup = "!git --no-pager lg --color | fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(echo {+2} | xargs git commit --fixup)+accept'"
# Interactive rebase
reb = "!git --no-pager lga --color | fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(echo {+2} | xargs git rebase -i --autosquash)+accept' --query='origin/main'"
# Interactive fixup=reword
reword = "!git --no-pager lg --color | fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(git commit --fixup=reword:{+2})+accept'"
# Interactive revert
rev = "!git --no-pager lg --color | fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(echo {+2} | xargs git revert)+accept'"
[apply]
whitespace = nowarn
[branch]
sort = -committerdate
[column]
ui = auto
[commit]
gpgsign = true
template = ~/.gitmessage
[core]
editor = nvim
excludesfile = ~/.gitignore
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
[delta]
plus-style = syntax "#283b4d"
plus-non-emph-style = syntax "#283b4d"
plus-emph-style = syntax "#316172"
plus-empty-line-marker-style = syntax "#283b4d"
minus-style = syntax "#3f2d3d"
minus-non-emph-style = syntax "#3f2d3d"
minus-emph-style = syntax "#763842"
minus-empty-line-marker-style = syntax "#3f2d3d"
features = side-by-side line-numbers decorations
syntax-theme = tokyonight_storm
navigate = true
[delta "line-numbers"]
line-numbers-minus-style = "#914c54"
line-numbers-plus-style = "#449dab"
line-numbers-zero-style = "#3b4261"
[difftool]
prompt = false
[format]
signoff = true
[github]
user = bpinto
[help]
autocorrect = 1
[init]
templatedir = ~/.git_template
[interactive]
diffFilter = delta --color-only
[pager]
diff = delta
log = delta
reflog = delta
show = delta
# Filter git log results with FZF and display commit on fzf preview box
lg = fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(echo -n {+2} | pbcopy)+accept'
# Filter git log results with FZF and display commit on fzf preview box
lga = fzf --ansi --delimiter='[*-]' --exact --multi --no-sort --preview 'echo {+2} | grep -E -o \"[a-f0-9]+\" | xargs git show -m --color' --reverse --bind 'enter:execute(echo -n {+2} | pbcopy)+accept'
# Bare commit
patch = cat
[push]
autoSetupRemote = true
# Setting to git 2.0 default to suppress warning message
default = simple
[pull]
rebase = true
[rebase]
updateRefs = true