forked from alrra/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitconfig
183 lines (129 loc) Β· 4.83 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
[alias]
a = commit --amend
br = branch
c = commit
ca = !git add -A && git commit # Commit all changes.
co = checkout
cp = cherry-pick
d = diff
dc = diff --cached
f = fetch
g = log --graph --pretty=custom # Show custom graph.
git = !exec git # Allow `$ git git git...`
l = log --pretty=custom # Show custom log.
lc = shortlog --email --numbered --summary # List contributors.
p = push
r = rebase
s = status
w = instaweb --httpd=webrick # Start web-based visualizer.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Find commits by source code.
cc = "!f() { \
git log --pretty=custom --decorate --date=short -S\"$1\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Find commits by commit message.
cm = "!f() { \
git log --pretty=custom --decorate --date=short --grep=\"$1\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Credit an author on the latest commit.
credit = "!f() { \
if [ -n \"$1\" ] && [ -n \"$2\" ]; then \
git commit --amend --author \"$1 <$2>\" -C HEAD; \
fi \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# List remote branches.
lrb = "!f() { \
remote="${1:-origin}"; \
git ls-remote --heads "$remote"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Merge GitHub pull request on top of the current branch or,
# if a branch name is specified, on top of the specified branch.
mpr = "!f() { \
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
declare branch=\"${2:-$currentBranch}\"; \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git checkout -B $branch && \
git rebase $branch pr/$1 && \
git checkout -B $branch && \
git merge pr/$1 && \
git branch -D pr/$1 && \
git commit --amend -m \"$(git log -1 --pretty=%B)\n\nClose #$1\"; \
fi \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove the tag with the specified tag name if
# exists and tag the latest commit with that name.
retag = "!f() { \
git tag -d "$1" &> /dev/null; \
git tag $1; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Remove last commits (by default it removes the last commit).
rlc = "!f() { \
declare n=\"${1:-1}\"; \
git reset --hard \"HEAD~$n\"; \
}; f"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Undo last commits (by default it undoes the last commit).
ulc = "!f() { \
declare n=\"${1:-1}\"; \
git reset --soft \"HEAD~$n\"; \
}; f"
[color "branch"]
current = green bold
local = green
remote = yellow
[color "diff"]
frag = magenta
meta = yellow
new = green
old = red
newMoved = cyan
oldMoved = blue
[color "status"]
added = green reverse
changed = yellow reverse
untracked = red reverse
[core]
abbrev = 12
attributesfile = ~/.gitattributes
autocrlf = input
editor = vim
excludesfile = ~/.gitignore
[diff]
# Show blocks of moved text of at least 20
# alphanumeric characters differently than adds/deletes.
#
# https://git-scm.com/docs/git-diff#git-diff-zebra
colorMoved = zebra
[diff "bin"]
# Use `hexdump` to diff binary files.
textconv = hexdump -v -C
[pretty]
custom = "%C(magenta)%h%C(red)%d %C(yellow)%ar %C(green)%s %C(yellow)(%an)"
# β β β β ββ author name
# β β β ββ message
# β β ββ date (relative)
# β ββ decorations (branch, heads or tags)
# ββ hash (abbreviated)
[push]
# Make `git push` automatically push relevant
# annotated tags when pushing branches out.
followTags = true
[user]
# Don't guess the user's identity.
# https://github.com/git/git/blob/90f7b16b3adc78d4bbabbd426fb69aa78c714f71/Documentation/config.txt#L2847-L2855
useConfigOnly = true
[include]
# Load local configs.
# https://git-scm.com/docs/git-config#_includes
#
# [!] The following needs to remain at the end of this file in
# order to allow any of the above configs to be overwritten
# by the local ones
path = ~/.gitconfig.local