-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathgitconfig.erb
More file actions
executable file
·183 lines (161 loc) · 5.99 KB
/
Copy pathgitconfig.erb
File metadata and controls
executable file
·183 lines (161 loc) · 5.99 KB
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
<% print("Your Full Name: "); STDOUT.flush; @fullname = STDIN.gets.chomp -%>
<% print("Your Email: "); STDOUT.flush; @email = STDIN.gets.chomp -%>
<% print("GitHub Username: "); STDOUT.flush; @github_username = STDIN.gets.chomp -%>
[user]
name = <%= @fullname %>
email = <%= @email %>
[github]
user = <%= @github_username %>
[credential]
<% if "#{`uname`}" == "Darwin" -%>
helper = osxkeychain
<% else -%>
helper = cache
<% end -%>
[alias]
# Top level shortcuts
ci = commit
co = checkout
df = diff
lg = log -p
sm = submodule
st = status -sb
# branch advanced helpers
branch-edit = branch --edit-description
branch-desc = !git config branch.${1:-`git symbolic-ref --short HEAD`}.description && :
<%- branch_format = '%(HEAD) %(color:red)%(align:9)%(objectname:short)%(upstream:trackshort)%(end)%(color:reset) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject)' -%>
<%- branch_format_ext = "#{branch_format} - %(authorname) (%(color:green)%(creatordate:relative)%(color:reset))" -%>
br = for-each-ref refs/heads/ --format='<%= branch_format %>'
brs = for-each-ref refs/heads/ --sort=creatordate --format='<%= branch_format %>'
brn = for-each-ref refs/heads/ --format='<%= branch_format_ext %>'
brsn = for-each-ref refs/heads/ --sort=creatordate --format='<%= branch_format_ext %>'
# log advanced helpers
lol = log --graph --pretty=oneline --abbrev-commit --decorate
lola = log --graph --pretty=oneline --abbrev-commit --decorate --all
<%- log_format = '%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' -%>
loln = log --graph --pretty=format:'<%= log_format %>' --abbrev-commit --decorate
lolan = log --graph --pretty=format:'<%= log_format %>' --abbrev-commit --decorate --all
# Omits any commits that came in from a merge, showing only the merge commit
lofirst = log --graph --pretty=oneline --abbrev-commit --decorate --first-parent
lonfirst = log --graph --pretty=format:'<%= log_format %>' --abbrev-commit --decorate --first-parent
# Shows commits per person in descending order
loscore = shortlog -n --summary
# tag advanced helpers
# NOTE: authorname/creator/taggername aren't usually set usefully when one makes a GH release, so don't bother with them
<%- tag_format = '%(HEAD) %(color:red)%(align:9)%(objectname:short)%(end)%(color:reset) %(color:yellow)%(refname:short)%(color:reset) - %(contents:body)' -%>
<%- tag_format_ext = "#{tag_format} (%(color:green)%(creatordate:relative)%(color:reset))" -%>
t = for-each-ref refs/tags/ --format='<%= tag_format %>'
ts = for-each-ref refs/tags/ --sort=creatordate --format='<%= tag_format %>'
tn = for-each-ref refs/tags/ --format='<%= tag_format_ext %>'
tns = for-each-ref refs/tags/ --sort=creatordate --format='<%= tag_format_ext %>'
# checkout Branch from remote (for when git co <branch_name> won't work
# because it matches more than one remote branch)
# checkout Branch
# git cobr <remote> <branch_name>
cobr = "!f() { git fetch $1 $2 && git checkout -b $2 $1/$2; }; f"
# checkout PR
# git copr <remote> <pr#>
copr = "!f() { git fetch $1 pull/$2/head:pr-$2 && git checkout pr-$2; }; f"
# pulls the latest tag or the default branch tip
pulllatest = "!git fetch origin; \
tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null); \
default=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p'); \
git checkout ${tag:-${default}}; \
if [ -z ${tag} ]; \
then git pull; \
fi"
#release-notes = "!sh -c 'git log $(git describe --tags --abbrev=0) --no-merges --not master | format_release_notes.rb' -"
# pulls the latest release or master for each submodule
smpull = submodule foreach git pulllatest
# file-on-branches
# git file-on-branches
file-on-branches = "!f() { \
git log --all --format=%H $1 | while read f; do \
git branch --contains $f; \
done | sort -u; \
}; f"
[branch]
autosetupmerge = true
# Per branch configuration
[branch "master"]
mergeoptions = --ff-only
[branch "develop"]
mergeoptions = --ff-only
[color]
diff = auto
status = auto
branch = auto
[core]
editor = /usr/bin/vim
excludesfile = ~/.gitignore
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf
autocrlf = input
<% diffmerge_path = `which diffmerge`.strip -%>
<% meld_path = `which meld`.strip -%>
<% opendiff_path = `which opendiff`.strip -%>
<% default_tool = diffmerge_path.empty? ? meld_path.empty? ? 'opendiff' : 'meld' : 'diffmerge' -%>
[diff]
tool = <%= default_tool %>
guitool = <%= default_tool %>
colorMoved = zebra
wsErrorHighlight = all
[diff "nodiff"]
command = /bin/true
[difftool]
prompt = false
<% unless diffmerge_path.empty? -%>
[difftool "diffmerge"]
cmd = <%= diffmerge_path %> "$LOCAL" "$REMOTE"
<% end -%>
<% unless meld_path.empty? -%>
[difftool "meld"]
path = <%= meld_path %>
<% end -%>
<% unless opendiff_path.empty? -%>
[difftool "opendiff"]
path = <%= opendiff_path %>
<% end -%>
[fetch]
prune = true
[help]
autocorrect = 1
[merge]
tool = <%= default_tool %>
guitool = <%= default_tool %>
wsErrorHighlight = all
[mergetool]
prompt = false
hideResolved = true
<% unless diffmerge_path.empty? -%>
[mergetool "diffmerge"]
cmd = <%= diffmerge_path %> --merge --result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
trustExitCode = true
<% end -%>
<% unless meld_path.empty? -%>
[mergetool "meld"]
path = <%= meld_path %>
# hideResolved doesn't work for meld, so turn off and use meld's auto-merge
hideResolved = false
useAutoMerge = auto
<% end -%>
<% unless opendiff_path.empty? -%>
[mergetool "opendiff"]
path = <%= opendiff_path %>
<% end -%>
[pull]
rebase = false
#ff = only
[push]
default = simple
[remote "origin"]
push = HEAD
[sendemail]
from = Peter P. Gengler <<%= @email %>>
smtpserver = smtp.gmail.com
smtpuser = ppgengler@gmail.com
smtpencryption = tls
smtpserverport = 587
chainreplyto = false
# Use SSH instead of HTTPS for github
[url "ssh://git@github.com/"]
insteadOf = https://github.com/