-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
gitconfig
156 lines (123 loc) · 3.62 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
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
156
[user]
name = Thorsten Lorenz
email = [email protected]
[core]
editor = nvim
excludesfile = /Users/thlorenz/.gitignore
[core "diff"]
tool = vimdiff
[mergetool "vimdiff"]
cmd = nvim -d $LOCAL $BASE -c '$wincmd w'
[color]
diff = true
ui = always
[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 = red
untracked = blue
[diff]
tool = vimdiff
[merge]
tool = vimdiff
# Include summaries of merged commits in newly created merge commit messages
log = true
[difftool]
prompt = false
[branch "master"]
# Use `origin` as the default remote on the `master` branch in all cases
remote = origin
merge = refs/heads/master
[push]
default = current
[alias]
# Lots came from:
# http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
# http://lukas.zapletalovi.com/2012/07/my-git-aliases-again.html
# List all aliases
al = "!git config -l | grep alias | cut -c 7-"
# Logs
## Summary with relative dates
lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
# Summary with full dates as first
ld = log --pretty=format:'%Cblue%ad%Creset | %s [ %Cred%h%Creset %C(yellow)%an%d%Creset ]' --date=format:'%Y-%m-%d %H:%M:%S'
ldd = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%ad)%Creset' --date=format:'%Y-%m-%d %H:%M:%S'
## Very short summary (not authors or dates)
ls = log --oneline --decorate
## Details (includes changed files)
ll = log --pretty=format:'%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]' --decorate --numstat
## Details of specific revision
llr = "!f() { git ll "$1"^.."$1"; }; f"
## Summary without Colors to allow piping
lnc = log --pretty=format:'%h\\ %s\\ [%cn]'
## Log differences between master and current branch (i.e. history since branching)
lh = !git --no-pager log origin/master..HEAD --abbrev-commit --pretty=oneline
# Diffs
## Show modified files in last commit
dl = !git ll -1
## Show diff of last commit
dlc = diff --cached HEAD^
## Show diff of specific revision
## Example: git dr HEAD~2
dr = "!f() { git diff "$1"^.."$1"; }; f"
dtr = "!f() { git difftool "$1"^.."$1"; }; f"
dt = difftool
dc = diff --cached
# Grep
## Find filepath in codebase
f = "!git ls-files | grep -i"
# Remotes
## Push origin/master showing differences and allowing abort
pom = !sh -c 'git lh && echo Ready to push? ENTER && read && git push origin master' -
ra = remote add
rr = remote remove
rsu = remote set-url
pu = pull
pur = pull --rebase
cl = clone
# Workflow
st = status --ignore-submodules -s
co = checkout
ci = commit
cm = commit -m
cam = commit -am
br = branch -v
amd = commit --amend --no-edit
up = pull --rebase
## Merging
mx = "!f() { git merge $1; git branch -d $1; }; f"
## Rebasing
bip = rebase -i --committer-date-is-author-date
bi = rebase -i
bc = rebase --continue
ba = rebase --abort
cleanup = "!git branch --no-color --merged | grep -v '\\*\\|master\\|develop\\|main' | xargs -n 1 git branch -d"
[mergetool]
keepBackup = true
[credential]
helper = osxkeychain
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[rerere]
enabled = false
autoupdate = true
[fetch]
prune = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[init]
defaultBranch = master
[pull]
ff = only