-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot_gitconfig
140 lines (117 loc) · 4.59 KB
/
dot_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
[alias]
a = add
ad = add
# https://nuclearsquid.com/writings/git-add/
adp = add --patch
br = branch
brd = branch -D
co = commit
com = commit -m
coa = commit --amend --no-edit
di = diff
dis = diff --staged
# dii for "DIff Inline"
dii = -c delta.side-by-side=false diff
ps = "!git push origin $(git branch-name)"
sw = switch
swc = switch -c
re = rebase
# Interactive rebase with the given number of latest commits.
rei = "!r() { git rebase -i HEAD~$1; }; r"
wt = worktree
wta = worktree add
wtr = worktree remove
wtl = worktree list
# Readable concise status
s = st
st = status -s -b
# Readable pretty logs
l = lo
lo = log --format='%h %Cred%ar%Creset %Cgreen%s' --graph
# View aliases
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\:\\ /
# Get the current branch name (not so useful in itself, but used in
# other aliases) via https://gist.github.com/robmiller/6018582
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Reset the current branch to origin's version
rs = "!git stash && git fetch origin -p && git reset --hard origin/$(git branch-name)"
# Delete all local branches that have been merged with the current branch. Ref: https://stackoverflow.com/a/46192689/517553
dm = "!git fetch -p && git branch -vv | grep ': gone]' | grep -v \"*\" | awk '{ print $1; }' | xargs -r git branch -d"
# Amend the previous commit
amend = "!git add -A && git commit --amend --no-edit"
# Update logs based on http://stackoverflow.com/a/34467298/517553
lo1 = "!git lo1-specific --all"
lo2 = "!git lo2-specific --all"
lo3 = "!git lo3-specific --all"
lo1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lo2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lo3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
# 'NEW BrancheS' list local branches ordered by newest commit date
newbs = for-each-ref --sort=committerdate refs/heads/ --format='%(color:reset)committed: %(color:yellow)%(committerdate:short) %(color:cyan)%(refname:short) %(color:reset)%(authorname)'
# Push the current branch to origin and track it
# publish = "!git push -u origin $(git branch-name)"
# Checkout a new branch in the format feat/{feature-name}
# nf = "!f() { git checkout -b \"feat/$1\" 2> /dev/null || git checkout \"feat/$1\"; }; f"
# Reset the current branch to upstream's version
# rs-upstream = "!git stash && git fetch upstream -p && git reset --hard upstream/$(git branch-name)"
# Merge changes from upstream into current branch
# merge-upstream = "!git rs-upstream"
[core]
editor = micro
excludesfile = ~/.gitignore
pager = delta
# http://www.git-tower.com/blog/make-git-rebase-safe-on-osx
# 2020 note. is this still needed?
trustctime = false
[color]
# Use colors in Git commands that are capable of colored output when outputting to the terminal
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[diff]
renames = copies # Detect copies as well as renames
algorithm = histogram # Histogram can give 'more human' diffs.
[include]
path = .gitconfig.personal
[init]
defaultBranch = main
[merge]
log = true # Include summaries of merged commits in newly created merge commit messages
conflictStyle = zdiff3 # Nicer diffs, hopefully. See https://github.blog/2022-01-24-highlights-from-git-2-35/
[pull]
rebase = true
[push]
default = simple
autoSetupRemote = true
[rebase]
autostash = true
autosquash = true
updateRefs = true
# Delta config
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
features = decorations
side-by-side = true
syntax-theme = Nord
[delta "interactive"]
keep-plus-minus-markers = true
[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