Repository navigation
Expand file tree
/
Copy pathdot_gitconfig.tmpl
More file actions
130 lines (113 loc) · 4.14 KB
/
Copy pathdot_gitconfig.tmpl
File metadata and controls
130 lines (113 loc) · 4.14 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
[user]
name = Jie Ma
{{ if eq .machine "work" }}
email = ma.jie@abc.net.au
{{ else }}
email = im@jma.dev
signingkey = 21A63631892F7F8A
{{ end }}
[mergetool]
prompt = false
keepBackup = false
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red
new = green
[alias]
# add
a = add # add
chunkyadd = add --patch # stage commits chunk by chunk
# via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}"
snapshots = !git stash list --grep snapshot
#via http://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
recent-branches = !git for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(refname:short)'
# branch
b = branch -v # branch (verbose)
bclean = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs git branch -d; }; f"
# commit
c = commit -m # commit with message
ca = commit -am # commit all with message
cmr = commit --reuse-message HEAD
ci = commit # commit
amend = 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
lg = log --abbrev-commit --decorate --pretty=oneline
changes = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\" --name-status
short = log --pretty=format:\"%h %cr %cn %Cgreen%s%Creset\"
simple = log --pretty=format:\" * %s\"
shortnocolor = log --pretty=format:\"%h %cr %cn %s\"
# pull
pl = pull # pull
# 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
#update-index
ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
ignored = !git ls-files -v | grep ^[a-z]
dsf = "!f() { [ -z \"$GIT_PREFIX\" ] || cd \"$GIT_PREFIX\" && git diff --color \"$@\" | diff-so-fancy | less --tabs=4 -RFX; }; f"
[format]
pretty = format:%C(blue)%ad%Creset %C(yellow)%h%C(green)%d%Creset %C(blue)%s %C(magenta) [%an]%Creset
[apply]
whitespace = nowarn
[push]
# 'git push' will push the current branch to its tracking branch
# the usual default is to push all branches
default = upstream
[core]
autocrlf = false
editor = nvim
pager = diff-so-fancy | less --tabs=4 -RFX
[pull]
rebase = true
[color "diff-highlight"]
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
oldNormal = red bold
[credential]
helper = osxkeychain
{{ if eq .machine "base" }}
[commit]
gpgsign = true
[includeIf "gitdir:~/code/irohas/"]
path = ~/.gitconfig-irohas
{{ end }}