-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_gitconfig
More file actions
120 lines (100 loc) · 3.49 KB
/
dot_gitconfig
File metadata and controls
120 lines (100 loc) · 3.49 KB
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
[core]
pager = less -E -F -X
excludesfile = ~/.config/git/ignore
editor = nvim
[color]
status = auto
diff = auto
interactive = auto
[alias]
bisect-fixed = bisect bad
bisect-unfixed = bisect good
ci = commit
cia = commit --amend
co = checkout
st = status
br = branch
sb = show-branch
sp = show -p
l = log
lp = log -p
di = diff
sl = stash list
sa = stash apply
ss = stash save
pu = push
pudr = push --dry-run
unstage = reset HEAD
staged = diff --cached
cp = cherry-pick
rb = rebase
rbc = rebase --continue
rbs = rebase --skip
rl = reflog
undo = reset --soft HEAD^
# Push shortcuts
mp = push origin master
mpd = push --dry-run origin master
rid = rebase master --ignore-date
# Diff shortcuts
d1 = diff HEAD^
d2 = diff HEAD^^
d3 = diff HEAD^^^
d4 = diff HEAD^^^^
d5 = diff HEAD^^^^^
d10 = diff HEAD^^^^^^^^^^
# Log with graph
lg = log -n 15 --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lgnm = log -n 15 --graph --no-merges --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lganm = log --no-merges --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lgau = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative --author-date-order
lgp = log --pretty=format:'%aD %s'
lf = log --name-only
# Recent branches
br7 = for-each-ref --count=7 --sort=-committerdate refs/heads/ --format='%(refname:short)'
br20 = for-each-ref --count=20 --sort=-committerdate refs/heads/ --format='%(refname:short)'
# Grep
grep = grep -Ii
gr = grep -Ii
f = "!git ls-files | grep -i"
# Assume unchanged
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
# Branch management
bak = !git branch `git br | grep '*' | sed -e 's/* /BAK_/'`
done = "!f() { git branch | grep \"$1\" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
publish = !sh -c 'git push origin \"$0\" && git config \"branch.$0.remote\" origin && git config \"branch.$0.merge\" \"refs/heads/$0\"'
# Grep from root
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
# Merge helpers
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
# Reset shortcuts
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# Prune local merged branches
prunelocal = !sh -c 'git branch -d `git branch --merged | grep -v \"^*\\|master\\|main\"`'
todo = grep --heading --break -e 'FIX:*' -e 'TODO:*'
[merge]
tool = vimdiff
[user]
name = Kevin Old
email = kevin@kevinold.com
[github]
user = kevinold
[rerere]
enabled = 1
[push]
default = current
[init]
defaultBranch = main
[hub]
protocol = ssh