-
Notifications
You must be signed in to change notification settings - Fork 0
/
aliases
134 lines (126 loc) · 4.1 KB
/
aliases
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
#
# scott@smemsh.net
# https://github.com/smemsh/.gitcli/
[alias]
#
stat = status
st = status
stn = status --untracked-files=no
pick = cherry-pick
br = branch
sh = show
#
ci = commit --quiet
cim = commit --quiet --message
cia = commit --quiet --all
ciam = commit --quiet --all --message
amend = commit --amend
remend = commit --amend --no-edit
co = checkout --quiet
clone = clone --no-hardlinks
addp = add --patch
ff = merge --ff-only
noff = merge --no-ff
pff = pull --ff-only
fpush = !git push -q -f origin +`git rev-parse --abbrev-ref @`
pushf = push --force
ds = describe --abbrev=999 --long --tags
head = show --no-patch --format=%H
this = rev-parse --abbrev-ref @
patch = rebase --show-current-patch
contains = merge-base --is-ancestor
#
logmsg = show -s --pretty=format:%B
last = log -1 HEAD
lasth = log -1 --format='%H%n%an <%ae>%n%aI'
lastone = log --oneline -1
lastfew = log --oneline -3
lastt = log --oneline -10
lasttt = log --oneline -30
lastn = "!bash -c '\
if [[ \"$1\" =~ ^[[:digit:]]+$ ]]; \
then a=$1; shift; set -- -$a \"$@\"; fi; \
git log --oneline \"$@\"; \
' git-lastn"
#
unstage = reset --quiet HEAD --
discard = reset --quiet --hard
#
fetchr = fetch --recurse-submodules
pullr = pull --recurse-submodules
repull = pull --rebase
lsr = remote --verbose
url = ls-remote --get-url
lsa = "!bash -c '\
if git cat-file -e \"$1\" 2>/dev/null; \
then rev=$1; shift; \
else rev=@; fi; \
test -n \"$1\" || set -- .; \
git ls-tree --abbrev=7 -l \"$rev\" \"$@\"; \
' git-lsa"
lsar = "!f () { git lsa -r $@; }; f"
#
inlog = log ..@{u}
outlog = log @{u}..
indiff = diff ..@{u}
outdiff = diff @{u}..
instat = diff --stat ..@{u}
outstat = diff --stat @{u}..
staged = diff --staged
wdiff = diff --color --word-diff=color --word-diff-regex=.
# TODO: https://github.com/newren/git-filter-repo/ is recommended by upstream
#
pathmv = "!bash -c '\
export FILTER_BRANCH_SQUELCH_WARNING=1; \
if test $# == 1; then initial=\"\"; prepend=\"$1\"; \
elif test $# == 2; then initial=\"$1\"; prepend=\"$2\"; \
else echo \"bad args\"; return 1; fi; \
git filter-branch --index-filter \"\
git ls-files -s \
| sed \\\"s,\\\\t$initial,&$prepend/,\\\" \
| GIT_INDEX_FILE=\\$GIT_INDEX_FILE.new \
git update-index --index-info && \
mv \\$GIT_INDEX_FILE.new \\$GIT_INDEX_FILE \
\" HEAD; \
' git-pathmv"
#
pathrm = "!bash -c '\
export FILTER_BRANCH_SQUELCH_WARNING=1; \
if test $# == 1; then path=\"$1\"; \
else echo \"bad args\"; return 1; fi; \
git filter-branch \
--force \
--prune-empty \
--tag-name-filter cat \
--index-filter \"\
git rm \
-r \
--cached \
--ignore-unmatch \
$path \
\" \
-- \
--all \
; \
' git-pathrm"
#
# same as recommentx except for sed line
recomment = "!bash -c '\
if test $# == 1; then prefix=\"$1\"; \
else echo \"bad args\"; return 1; fi; \
git filter-branch -f --msg-filter \"\
sed -r \\\"s,^,$prefix,\\\" \
\"; \
' git-recomment"
#
# same as recomment but keeps 2-char prefix
# TODO how to not duplicate everything but the sed line with above command?
# maybe have to use external script
#
recommentx = "!bash -c '\
if test $# == 1; then prefix=\"$1\"; \
else echo \"bad args\"; return 1; fi; \
git filter-branch -f --msg-filter \"\
sed -r \\\"s,^(..)(.*),\\1$prefix\\2,\\\" \
\"; \
' git-recommentx"