-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitconfig
216 lines (155 loc) · 5.33 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
[user]
email = [email protected]
name = Sébastien Douche
[core]
excludesfile = /home/sdouche/.gitignore
pager = "less -FXRS"
editor = vim
whitespace = trailing-space,space-before-tab
autocrlf = input
[branch]
master = rebase
[push]
default = simple
[merge]
tool = meld
conflictstyle = diff3
stat = true
[diff]
tool = meld
algorithm = patience
mnemonicprefix = true
renames = copies
[rerere]
enabled = true
autoupdate = 1
[color]
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
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
branch = green
[url "https://github.com"]
insteadOf = gh:
[url "https://gist.github.com/"]
insteadOf = gist:
[url "https://bitbucket.org/"]
insteadOf = bb:
[alias]
##### Basic aliases
# Status
st = status
s = status -s
# Branches
br = branch
bra = branch -a
sb = show-branch
# Commit
ci = commit
# Checkout
co = checkout
# Show remote repositories
r = remote -v
# Amend last commit
amend = ci --amend
# Removes files/directories from staging
unadd = reset HEAD --
##### Diff aliases
# Diff and show commands with word-diff style
wd = diff --word-diff
ws = show --word-diff
# Show diff before pull
do = diff ORIG_HEAD HEAD
# Show modified lines in the index
staged = diff --cached
# Show modified files
changes = diff --name-status -r
# Diff with statistics
ds = diff --stat -r
##### Log aliases
# Show HEAD commit
head = log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -n1
# Show commits from origin/master to HEAD
heads = !git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'
# Short one line logs with ref-names
l = log --oneline --decorate=short
# Shows the last git logentry (hash, author, date commitmessage)
llm = log -1
# Last log message of all submodules
llms = !git sf "git llm;"
# Short one line logs with ref-names and statistics
gl = log --oneline --decorate --stat --graph
# Short one line logs with ref-names (yellowà, date (green) and author (blue)
glog = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# Show fetched commits
lc = log ORIG_HEAD.. --stat --no-merges
# Graph log with full commit message
glaaa = log --graph --abbrev-commit --date=relative
##### Submodules
# Shows current sha1s of all submodules and number of commits
shc = !git sf 'git h; git c'
# Runs submodule-initialisation and update after a fresh checkout RECURSIVE!
siu = !git submodule init; git submodule update; git submodule foreach \"git siu\"
# Pushs all submodules to origin master
pushsub = submodule foreach "git push origin master"
# Pull submodules from origin master
pullsub = submodule foreach "git pull origin master"
# Shortcut when running something on all submodules - eg. git sf "git s"
sf = submodule foreach
##### Application
# Opens gitk with all branches and current branch
k = !gitk --all --select-commit=HEAD &
# Opens meld the diff-viewer with current directory
m = !meld . &
# [g = gui]
g = !git gui &
# [q = qgit]
q = !qgit &
# Opens git gui if there are changes in the repository
icg = !REPOCHANGED=`git s`; REPOCHANGED=${#REPOCHANGED}; if [ $REPOCHANGED != 0 ]; then git gui & fi;
# Open git guis for all submodules which have changes
subgui = submodule foreach git icg
##### Misc
# Show last commiter
whois = !sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -
# Show last commit message
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# Hash of HEAD
h = rev-list --max-count=1 HEAD
# Show users which have commits in current branch
ul = !git log --format='%aN' | sort -u
# Remove deleted files
r = !git ls-files -z --deleted | xargs -0 git rm
# Start a new local repository and perform initial commit
icommit = git commit --allow-empty -m \"Initial commit\"
# Show users which have commits in current branch, including number of commits, sorted (most commits last)
uccl = !git log --format='%aN <%aE>' | awk '{arr[$0]++} END{for (i in arr){print arr[i], i;}}' | sort -n
# Number of commits in current branch
c = !git log --oneline | wc -l
# Creates a tar.gz archive named after the last commits hash from HEAD! in the directory above the repository
ahg = !git archive HEAD --format=tar | gzip > ../`git h`.tar.gz
# shows ignored directories
ignored = !git ls-files --others -i --exclude-standard --directory
# Move to the root of the repository
root = !cd $(git rev-parse --show-cdup)
# Show the root directory of the repository
sroot = rev-parse --show-toplevel
# Prune remote branches
prune-all = !git remote | xargs -n 1 git remote prune
# Show aliases
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
# Show upstream for the current branch
upstream = !git for-each-ref --format='%(upstream:short)' `git symbolic-ref HEAD`