-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitconfig
215 lines (180 loc) · 6.27 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
[color]
diff = auto
ui = true
grep = 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
[user]
name = Pawel Palucki
email = pawel.palucki@intel.com
[github]
user = ppalucki
[gitreview]
username = pawel.palucki
[core]
excludesfile = ~/dotfiles/.gitignore_global
pager = less -F -X
autocrlf = input
[push]
default = upstream
[alias]
# dont add -n to logs l/lg because it disables possibility to asks for logs from master...
l = log --oneline --decorate
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(blue)%an%Creset' --abbrev-commit --date-order
# lg with full date
lgd = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ci)%Creset %C(blue)%an%Creset' --abbrev-commit --date-order
st = status
ci = commit
d = difftool
dd = difftool -t dirdiff -d
ds = diff --stat
b = branch -vv
branches = branch -vv
branchesall = branch -a -vv
# OR: for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
branchesdate = for-each-ref --sort=committerdate refs/heads/ --format='%(committerdate:short) (%(committerdate:relative)) %(refname:short)'
branchesdateall = for-each-ref --sort=committerdate refs/remotes/ --format='%(committerdate:short) (%(committerdate:relative)) %(refname:short)'
co = checkout --no-guess
# co = checkout
cob = checkout -b
ciam = commit -a -m
ciamwip = commit -a -m WIP
ciav = commit -a --verbose
cim = commit -m
civ = commit --verbose
ca = commit --amend
caa = commit -a --amend
unstash = stash pop
mt = mergetool
# moved to aliases
# grepall = git rev-list --all | xargs git grep
#
upstream = rev-parse --abbrev-ref --symbolic-full-name @{u}
# or for scripting git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)
# http://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
# recover = log --graph --oneline --decorate $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
# For Github (get a pull request
# gpr = '!sh -c "git fetch origin pull/${1}/head:pr/${1}" -'
# with a command like this
# git config --global alias.gpr '!sh -c "git fetch origin pull/${1}/head:pr/${1}" -'
# doesn't not WORK!!!
# without need to fetch refspec before and it won't allow you to update this in future
gpr = !sh -c \"git fetch origin pull/${1}/head:pr/${1}\" -
gprintel = !sh -c \"git fetch intel pull/${1}/head:pr/${1}\" -
# unieversal pull request from github
# git gpr intel 356
gpremote = !sh -c \"git fetch ${1} pull/${2}/head:pr/${2}\" -
pushinit = !sh -c \"git push --set-upstream origin `git rev-parse --abbrev-ref HEAD`\"
# tags + commits (-d --derefernce)
#tags = show-ref --abbrev=7 --tag -d
tags = for-each-ref --sort=creatordate --format '%(refname) %(creatordate)' refs/tags
checkoutr = checkout
[diff]
tool = vimdiff
# can be called with -t dirdiff -d
# tool = dirdiff
guitool = diffuse
[difftool "dirdiff"]
cmd = vim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' $LOCAL $REMOTE
options = --symlinks
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[merge]
defaultToUpstream = true
### if you want "base" view then use vimdiff
# tool = vimdiff
tool = fugitive
options = --no-edit
# ???????? http://stackoverflow.com/questions/11133290/git-merging-using-meld
conflictstyle = diff3
[mergetool]
keepBackup = false
[mergetool "fugitive"]
cmd = vim -f -c \"Gdiff\" \"$MERGED\"
keepBackup = false
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[mergetool "vimdiff"]
keepBackup = false
# http://stackoverflow.com/questions/11133290/git-merging-using-meld
[mergetool "mymeld"]
cmd = meld --auto-merge $LOCAL $BASE $REMOTE --diff $LOCAL $BASE $REMOTE --output $MERGED --diff $BASE $LOCAL --diff $BASE $REMOTE
# git gui helpers
[guitool "reset file"]
cmd = git checkout $REVISION -- $FILENAME
[guitool "remove file"]
cmd = rm $FILENAME
[guitool "Rebase onto..."]
cmd = git rebase $REVISION
revprompt = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip"]
cmd = git rebase --skip
[guitool "Rebase/Abort"]
cmd = git rebase --abort
[guitool "Pull with Rebase"]
cmd = git pull --rebase
; #[http]
; proxy = http://proxy-jf.intel.com:911
; [https]
; proxy = http://proxy-jf.intel.com:911
# [http]
# sslVerify = false
# 1. # (deprecated) Its is much better to generate token and create ~/.netrc for github
# [url "git@github.com:"]
# insteadOf = https://github.com/
#
# 2. libcurl netrc
# example ~/.netrc
# machine github.com
# login ppalucki
# password GENERATED_TOKEN_FROM_GITHUB
#
# 3. url replaceent - and one more way is:
# unfortunately I want my gitconfig in dotfiles
#[url "https://AN_OAUTH_TOKEN:x-oauth-basic@github.com/"]
# insteadOf = https://github.com/
#
# 4. cache
# https://git-scm.com/docs/git-credential-cache
# git config credential.helper 'cache [options]'
# eg.
# git config credential.helper --global 'cache --timeout=600'
# but it doesn't work with two factor auth
# [credential]
# helper = cache
[credential]
helper = cache --timeout=7200
[rerere]
enabled = true
########################## OTHER TRICKS ##############################
# working with github branches
# http://blogs.atlassian.com/2014/08/how-to-fetch-pull-requests/
# https://gist.github.com/piscisaureus/3342247
# add refspecs to [remote]
# fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
# this will fetch all pr/PRNUMBER/head as tracking
# then you can just git checkout pr/110 or update with git fetch and git reset --hard origin/pr/110
#[oh-my-zsh]
# hide-status = 1
# hide-dirty = 1
# Access by git by tunnel
# ssh -R 1337:proxy-mu.example.com:1080 root@node36
# # IF IT HANGS TRY TO KILL OTHER SSHD in background
#[http]
#proxy = socks5://127.0.0.1:1337