-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitconfig
181 lines (162 loc) · 7.17 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
# set your user tokens as enivornment variables, such as ~/.secrets
# See the README for examples.
[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
[alias]
# add
a = add # add
chunkyadd = add --patch # stage commits chunk by chunk
# branch
b = branch -v # branch (verbose)
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
ci = commit # commit
amend = commit --amend # ammend your last commit
ammend = commit --amend # ammend your last commit
# checkout
co = checkout # checkout
nb = checkout -b # create and switch to a new branch (mnemonic: "git new branch branchname...")
# cherry-pick
cp = cherry-pick -x # grab a change from a branch
# diff
d = diff # diff unstaged changes
dc = diff --cached # diff staged changes
last = diff HEAD^ # diff last committed change
# log
# l = log --graph --date=short
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
changelog = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
lastcommiters = !"git for-each-ref --sort=-committerdate refs/remotes/ --format='%(refname) %(committerdate) %(authorname) %(subject) ' "
lg1 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative
lg2 = log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit
l = !"git lg1"
lg = log --pretty=format:'%C(bold blue)%h%Creset -%C(bold green)(%ar)%Creset %s %Cgreen %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit
# https://coderwall.com/p/7jbwww?utm_campaign=weekly_digest&utm_content=Privately+receive+personally+curated&utm_medium=email
yesterday = !"git lg --graph --all --since=day.before.yesterday.midnight --until=midnight"
today = !"git lg --graph --all --since=midnight"
# pull
pl = pull # pull
pu = pull --rebase
# push
ps = push # push
# rebase
rc = rebase --continue # continue rebase
rs = rebase --skip # skip rebase
# remote
r = remote -v # show remotes (verbose)
# reset
unstage = reset HEAD # remove files from index (tracking)
uncommit = reset --soft HEAD^ # go back before last commit, with files in uncommitted state
filelog = log -u # show changes to a file
mt = mergetool # fire up the merge tool
# stash
ss = stash # stash changes
sl = stash list # list stashes
sa = stash apply # apply stash (restore changes)
sd = stash drop # drop stashes (destory changes)
# status
s = status # status
st = status # status
stat = status # status
# tag
t = tag -n # show tags with <n> lines of each tag message
# svn helpers
svnr = svn rebase
svnd = svn dcommit
svnl = svn log --oneline --show-commit
# helpful http://blog.blindgaenger.net/advanced_git_aliases.html
this = !git init && git add . && git commit -m \"Initial commit\"
amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend
r = !git ls-files -z --deleted | xargs -0 git rm
alias = !git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\=> \\2/' | sort
# http://felixge.de/2013/08/08/vim-trick-open-current-line-on-github.html
url =!git config --get remote.origin.url | sed -E "s/.+:\\(.+\\)\\.git$/https:\\\\/\\\\/github\\\\.com\\\\/\\\\1/g"
# https://github.com/barnardb/dotfiles/blob/master/contents/.gitconfig
push-no-hook = !"pushNoHook() { if [ -e .git/hooks/pre-push ]; then mv .git/hooks/pre-push .git/hooks/pre-push-disabled-by-alias && { git push \"$@\"; mv .git/hooks/pre-push-disabled-by-alias .git/hooks/pre-push; } else git push \"$@\"; fi; }; pushNoHook"
# my
open = !git url | awk '{ print \"open \" $1 }' | bash
pr = !git url | awk '{ print \"open \" $1 \"/pull/new/$(git branch --show-current)\" }' | bash
jenkins = !git config --get remote.origin.url | sed -E "s/.+:alpe\\(.+\\)\\.git$/https:\\\\/\\\\/ci\\\\.alpe1\\\\.com\\\\/view\\\\/Staging\\\\/job\\\\/\\\\1/g" | awk '{ print \"open \" $1 }' | bash
zip = !git archive HEAD --format=zip > archive.zip
hash = !git rev-parse HEAD
df= !git diff --stat
travis = !git config --get remote.origin.url | sed -E "s/.+:alpe\\(.+\\)\\.git$/https:\\\\/\\\\/travis-ci\\\\.org\\\\1/g" | awk '{ print \"open \" $1 }' | bash
cpull = !"checkoutPR() { git fetch origin pull/$1/head:$1 ; git checkout $1; }; checkoutPR"
staash = stash --all
# unsafe repair for "fatal: bad tree object". https://stackoverflow.com/questions/36876512/how-can-i-fix-a-git-error-broken-link-from-tree-to-tree/69639136#69639136
repair = !git stash clear && git reflog expire --expire-unreachable=now --all && git gc --aggressive --prune=now
[format]
pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset
[mergetool]
prompt = false
[mergetool "mvimdiff"]
cmd="mvim -c 'Gdiff' $MERGED" # use fugitive.vim for 3-way merge
keepbackup=false
[merge]
summary = true
verbosity = 1
tool = kdiff3
commit = no
[apply]
whitespace = nowarn
[branch]
autosetupmerge = true
sort = -committerdate
[push]
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = tracking
followTags = true
[core]
autocrlf = false
editor = vim
excludesfile = ~/.gitignore
[advice]
statusHints = true
[diff]
# Git diff will use (i)ndex, (w)ork tree, (c)ommit and (o)bject
# instead of a/b/c/d as prefixes for patches
mnemonicprefix = true
[rerere]
# Remember my merges
# http://gitfu.wordpress.com/2008/04/20/git-rerere-rereremember-what-you-did-last-time/
enabled = true
[user]
name = Alex Peters
email = [email protected]
signingkey = 8857F1AF4A9ECC4A0F1A396652E47A1C1FE6CFF3
[web]
browser = ch
[browser "ch"]
cmd = open -a \"/Applications/Google Chrome.app\"
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[init]
templatedir = ~/.git-templates
defaultBranch = main
[gpg]
program = gpg
[commit]
gpgsign = true
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
[url "[email protected]:"]
insteadOf = https://github.com/
[column]
ui = auto