-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
159 lines (126 loc) · 4.53 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
[gist]
browse = 1
[core]
editor = vim
pager = tig
excludesfile = ~/.gitignore
[pager]
diff = false
graph = false
[color]
ui = true
diff = true
pager = false
[color "branch"]
current = blue
local = yellow
remote = green
[color "status"]
added = green
changed = yellow
untracked = red
[difftool "Kaleidoscope"]
cmd = ksdiff-wrapper git \"$LOCAL\" \"$REMOTE\"
[difftool]
prompt = false
[diff]
mnemonicprefix = true
# Meld
#external = git-meld
# Kaleidoscope
#tool = Kaleidoscope
[gc]
auto = 0
reflogExpire = never
reflogexpireUnreachable = 100 days
[branch]
autosetupmerge = true
autosetuprebase = never
[merge]
stat = true
[mergetool]
keepBackup = false
[push]
default = tracking
[help]
autocorrect = 1
[url "git@github.com:"]
insteadOf = "ghs:"
pushInsteadOf = "ghs:"
[url "git://github.com/"]
insteadOf = "gh:"
[url "git@gist.github.com:"]
insteadOf = "gists:"
pushInsteadOf = "gists:"
[url "git://gist.github.com/"]
insteadOf = "gist:"
[url "git@bitbucket.org:"]
insteadOf = "bbs:"
pushInsteadOf = "bbs:"
[url "https://bitbucket.org/"]
insteadOf = "bb:"
[alias]
# Repository
cleanup = "!f() { echo \"This will prune ${1-origin}, run GC and clear stash.\nAre you sure ? (RETURN to continue | CTRL+C to cancel)\" && read && git remote prune \"${1-origin}\" && git gc && git stash clear; }; f"
ignore = "!f() { [ ! -e \"$GIT_PREFIX.gitignore\" ] && touch \"$GIT_PREFIX.gitignore\"; echo \"$1\" >> $GIT_PREFIX.gitignore; }; f"
make = "!f() { [ -z $2 ] && git init; [ ! -z $2 ] && git init --template=\"$HOME/$2\" && git commit --allow-empty -m\"${1-'Initial commit'}\"; }; f"
cl = "!f() { [ -z $1 ] && echo \"Usage: git cl <url> [<template>]\" && exit 1; [ -z $2 ] && git clone $1; [ ! -z $2 ] && git clone $1 --template=\"$HOME/.gittemplates/$2\"; }; f"
# Configuration
aliases = "!git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\t=> \\2/' | sort"
# Staging
addall = !git add -u && git add . && git ls
patch = add --patch
unadd = !git reset HEAD --
unchanged = update-index --assume-unchanged
changed = update-index --no-assume-unchanged
# Commit
amend = commit --amend -C HEAD
cp = cherry-pick -ex
undo = !git reset --soft HEAD~ && git ls
# Branching
br = "!f() { git for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset)|%(color:red)%(objectname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))|%(contents:subject)|%(authorname)' | column -ts'|'; }; f"
bra = !git br -a
brr = !git br -r
brn = !git bra --no-merged
cb = checkout -b
pwd = rev-parse --abbrev-ref HEAD
# Workflow
develop = checkout develop
master = checkout master
go = "!f() { [ -z $1 ] && echo \"Usage: git go <branch>\" && exit 1; git branch $1 2>/dev/null; git checkout $1; }; f"
finish = "!f() { BRANCH=$(git pwd); git rebase -i $1 && git checkout $1 && git merge $BRANCH; }; f"
wip = "!f() { BRANCH=$(git pwd); (git go wip/$1) && git addall && git commit -m'Work in progress' && git checkout $BRANCH; }; f"
stashstash = "!f() { STASH=$(git stash); echo \"\\033[0;31mKouroukoukou roukoukou stash stash\\033[0m\"; echo \"$STASH\"; open \"http://www.youtube.com/watch?v=LpE1bJp8-4w&feature=youtu.be&t=47s\" > /dev/null 2>&1 & }; f"
satsh = !git stashstash
stach = !git satsh
sa = !git satsh
# Status
d = !git --no-pager diff
dc = !git d --cached
st = !tig status
stat = diff --stat
ls = status --short
# Remote
fetchor = fetch origin
fetchup = fetch upstream
pullor = !git rp origin
pullup = !git rp upstream
pushor = push origin
pousse = push
pushup = push upstream
rp = pull --rebase
radd = remote add
# Log
l = !git log | tig -FRSX
ll = !GIT_PAGER='less -FRSX' git log --date=short --pretty=format:'%Cred%h%Creset%x09%Cgreen%cr%Creset%x09%C(cyan)%an%Creset %s%x09%C(yellow)%d%Creset'
graph = !GIT_PAGER='less -FRSX' git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative --all
# Github
# https://github.com/defunkt/gist
gist = !gist
ghinit = !sh -c 'git config --add 'remote.${1-origin}.fetch' '+refs/pull/*/head:refs/remotes/${1-origin}/pr/*''
prstart = !sh -c 'git fetch '${2-origin}' && git checkout pr/$0'
# Utilities
g = gui
k = !gitk --all > /dev/null 2>&1
# http://jonas.nitro.dk/tig/
t = !tig