-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitconfig
222 lines (220 loc) · 9.36 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
217
218
219
220
221
222
#
# see docs: https://www.kernel.org/pub/software/scm/git/docs/git-config.html
#
[user]
name = Steffen Gransow
email = [email protected]
editor = vim
[github]
user = graste
[alias]
# list aliases
aliases = "!git config -l | grep alias | cut -c 7-"
# yeah...but...ehm...you know
br = branch
co = checkout
ci = commit
di = diff
st = status
# list tags, branches and remotes
tags = tag -l --sort=creatordate
branches = branch -a
remotes = remote -v
# current branch name
localbranch = rev-parse --abbrev-ref HEAD
currentbranch = status | head -1
# latest tag
latest-tag = describe --tags --abbrev=0
# useful stuff
unstage = reset HEAD --
undo-commit = reset --soft HEAD^
unpushed = diff origin/master..HEAD --name-status
sshow = "!f() { git stash show stash^{/$*} -p; }; f"
sapply = "!f() { git stash apply stash^{/$*}; }; f"
# cdiff and sdiff are the same according to man page
cdiff = diff --cached
sdiff = diff --staged
# difff = diff HEAD | pygmentize -l diff | less -R
# subjects of log messages only: can be used with vX.X.X..vX.X.Y or --since and --until, use %B for complete commit messages
changelog = log --pretty=%s --first-parent --no-merges
# some aliases for history and last activities
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
history = log --graph --pretty=oneline --abbrev-commit
# last commit
last = log -1 HEAD
# all of last week's commits
lastweek = log --pretty=format:\"%h %ad | %s%d [%an]\" --since=\"7 days ago\" --graph --date=short
# history as colored graph with relative dates and authors
lg = log --graph --abbrev-commit --all --decorate=short --date=relative --pretty=format:'%C(red)%h%C(reset) - %s %C(green)(%cr) %C(bold blue)<%an>%C(reset)%C(bold yellow)%d%C(reset)'
# what's not in upstream
notup = log --graph --decorate --pretty=oneline --abbrev-commit --all @{upstream}^..
# search through things
dump = cat-file -p
type = cat-file -t
# stash untracked and tracked files
stash = stash --include-untracked
# stash ignored, untracked, and tracked files
stash-all = stash --all
# get access to the notes that might be available due to Github discussions on a Pull Request etc.
# use this via: git show HEAD --show-notes=github-comments
# fetch = +refs/notes/*:refs/notes/*
# show diff between the latest commit and the current state
diff-latest = "!git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
# found in https://github.com/mathiasbynens/dotfiles/blob/master/.gitconfig#L8
diff-to-last = "!d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# find branches containing commit
find-branches-containing-commit = "!f() { git branch -a --contains $1; }; f"
# find tags containing commit
find-tags-containing-commit = "!f() { git describe --always --contains $1; }; f"
# find commits by source code
find-commits-by-source-code = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f"
# find commits by commit message
find-commits-by-commit-message = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f"
# show branches that have already been merged with master
show-merged-branches = "!git branch --merged | grep -v '\\*'"
# show all changes of a specific file including renames etc.
show-file-changes = log --follow --stat -p
# list all commits for given branch(es) that are not in the current branch
find-missing-commits = "!f() { git log $@ ^$(git rev-parse --abbrev-ref HEAD) --no-merges --oneline; }; f"
# list all commit messages for given branch(es) that are not in the current branch
find-missing-commits-verbose = "!f() { git log $@ ^$(git rev-parse --abbrev-ref HEAD) --no-merges; }; f"
# find commit with deleted file
find-commit-where-file-was-deleted = rev-list -n 1 HEAD --
# restore deleted file from commit before it was deleted
undelete-file = "!f() { git checkout $(git rev-list -n 1 HEAD -- $1)^ -- $1; }; f"
# skip gitlab CI build
push-ohne-gitlab-ci = push -o ci.skip
[apply]
# detect a new or modified line that has whitespace errors when applying a patch
# see: core.whitespace configuration
# set to: nowarn | warn (default) | fix | error | error-all
whitespace = fix
[branch]
# set "pull" to use merge for all tracking branches (local and remote)
# set to: false | true (default) | always
autoSetupMerge = always
# set "pull" to use rebase instead of merge for all tracking branches (local and remote)
# set to: always | local | never (default) | remote
autoSetupRebase = always
[clean]
# make git-clean do nothing unless given -f, -i or -n
requireForce = true
[color]
branch = auto
diff = auto
grep = auto
interactive = auto
pager = true
showBranch = auto
status = auto
ui = auto
[core]
# see .gitattributes docs as well: https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
#autocrlf = input
# one of: lf | crlf | native (default)
eol = native
# warn about mixed line endings
#safecrlf = true
# comma separated list of common whitespace problems to notice - use "-" to disable any of them
whitespace = trailing-space,space-before-tab,tab-in-indent,-indent-with-non-tab,cr-at-eol,tabwidth=4
# trust inode change time (may be useful to set to false)
trustctime = true
# global .gitignore
excludesFile = ~/.gitignore_global
[credential]
helper = cache --timeout=3600
[diff]
# detect multiple renamed/copied files
renames = copies
renameLimit = 9999
# one of: myers (default) | minimal | patience | histogram
algorithm = histogram
# remove /a and /b before files
noprefix=true
[help]
format = man
# 0 = show mistyped command candidate | n = number of deciseconds prior to automatic execution of the one candidate
autoCorrect = 30
[init]
defaultBranch = main
[merge]
# <<<< |||| >>>> - includes local version in addition to left and right stuff
conflictstyle = diff3
# include summaries of merged commits in newly created merge commit messages
log = true
[pack]
# autodetect number of cpu cores – this is faster, but hijacks all cpu cores on huge repos
threads = 0
#[pull]
# preserve the history of everybody and avoid origin merge commits
# this means, that "git pull --rebase" preserves sync-merges (by default local merges are dropped)
#rebase = preserve
[push]
# current = only push to the same named remote branch
# matching = push all matching local branches (default for git < v2.0)
# simple = like upstream or current - only push the current branch used for pulling (new default for git > v2.0)
# set to: current | matching | nothing | simple | upstream
default = current
# automatically push relevant tags as well
followTags = true
[rebase]
# show a diffstat of what changed upstream since the last rebase
stat = true
# automatic handling of !squash commit messages; only applies to --interactive rebasing
autoSquash = true
# automatic stash and apply – beware: may lead to hard to resolve conflicts
autoStash = true
# "git rebase -i" behaviour: warn | error | ignore (default)
missingCommitsCheck = warn
[receive]
# defaults to 5 seconds, 0 disables it
keepAlive = 20
[rerere]
# activate recording of resolved conflicts to get auto-resolving of identical conflicts later on
enabled = true
# update index w/ result of cleanly resolved conflicts using previously recorded resolution
autoUpdate = true
[status]
# show branch and tracking info (event in short status)
branch = true
# show paths relative to repository root?
relativePaths = true
# normal | no | all
showUntrackedFiles = normal
# summary of commits for modified submodules (true = -1 = unlimited; use a number otherwise)
submoduleSummary = true
[stash]
# "git stash show" displays patch
showPatch = true
# "git stash show" displays diff stats
showStat = true
[tag]
# sort by version numbers by default instead of lexicographic search
sort = version:refname
[versionsort]
# sort by version number should sort v1.0-rcX before v1.0 etc.
suffix = -
suffix = -pre
suffix = .pre
suffix = -beta
suffix = .beta
suffix = -rc
suffix = .rc
[uploadpack]
# defaults to 5 seconds, 0 disables it
keepAlive = 20
# hack on own submodules that otherwise may be readonly (via http://neva.li/post/565899843)
# and when you want to force one protocol over another; pushinsteadOf etc. is available as well
[url "ssh://[email protected]/"]
insteadOf = "[email protected]:"
insteadOf = "https://github.com/"
[url "ssh://[email protected]/"]
insteadOf = "[email protected]:"
insteadOf = "https://gist.github.com/"
[url "ssh://[email protected]/"]
insteadOf = "[email protected]:"
insteadOf = "https://gitlab.berlinonline.net/"
# bin/git-open bash script needs this to know the gitlab url to use
[gitopen "gitlab"]
domain = https://gitlab.berlinonline.net/