-
Notifications
You must be signed in to change notification settings - Fork 5
/
_gitconfig
108 lines (84 loc) · 3.25 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
; vim: ft=gitconfig
[user]
name = Sam Merrell
email = [email protected]
signingkey = B63509B5C2E449F7!
[commit]
gpgsign = true
[core]
excludesfile = ~/.gitignore_global
autocrlf = input
pager = delta --dark
[interactive]
diffFilter = delta --dark --color-only
[delta]
features = line-numbers decorations
whitespace-error-style = 22 reverse
[help]
# git lgo corrected to git log. Yay!
autocorrect = -1
[color]
pager = true
status = auto
branch = auto
diff = auto
interactive = auto
[fetch]
prune = true
[pull]
ff = only
[alias]
# Get the default branch for origin. This comes from StackOverflow
# https://stackoverflow.com/a/44750379 This makes it so while we transition
# away from using the "master" terminology the aliases work. The added
# benefit is that it should work for any default branch name, so if people
# use main, dev, develop, trunk, etc. the aliases should still function as
# expected.
#
# Also, this alias is here because you can do nested aliases in git now! I
# didn't realize that it was enabled in 2.20, so thanks again StackOverflow
# https://stackoverflow.com/a/52863852
def = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
# Rebase the current branch off the default branch (see def above). You can
# also choose to pass in a branch name if you are trying to rebase from a
# different branch.
#
brebase = !sh -c 'def=$(git def) && git checkout ${1:-$def} && git fetch origin && git merge origin/${1:-$def} --ff-only && git checkout @{-1} && git rebase ${1:-$def}' -
# Pull the latest from upstream and push it to my fork at origin
updef = !def=$(git def) && git checkout $def && git fetch upstream && git merge upstream/$def --ff-only && git push origin HEAD
# Prune branches and delete any that are already merged into the default
# branch borrowed from here:
# https://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged
pbranch = !sh -c 'def=$(git def) && git checkout $def && git pull && git checkout - && git branch --merged | egrep -v "\\(^\\\\*\\|main\\)" | xargs git branch -d'
# Log aliases
lg = log --graph --pretty=format:'%C(yellow)%h%C(reset) -%C(red)%d%C(reset) %s %C(green)(%cr) %C(cyan)[%an]%C(reset)' --abbrev-commit --date=relative --decorate
ll = log --pretty=format:'%C(yellow)%h%C(reset) -%C(red)%d%C(reset) %s %C(green)(%cr) %C(cyan)[%an]%C(reset)' --abbrev-commit --date=relative --decorate
lstat = log --name-status --abbrev-commit --date=local --pretty=format:'%C(yellow)%h%C(red)%d%C(reset) %C(cyan)%cr %C(green)[%cn] %Creset%C(yellow)%n%s'
# Working with files / history
revive = !sh -c 'git checkout $(git rev-list -n 1 HEAD -- "$1")^ -- "$1"' -
di = diff --staged
# Misc
fmerge = merge --ff-only
stache = stash save -u
cia = commit --amend -C HEAD
rbc = rebase --continue
[log]
date = local
[github]
user = smerrell
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[filter "lfs"]
clean = git lfs clean %f
smudge = git lfs smudge %f
required = true
[includeIf "gitdir:~/Projects/work/"]
path = .gitconfig_work
[pull]
rebase = false
[init]
defaultBranch = main
[gpg]
program = /usr/local/MacGPG2/bin/gpg