forked from hutusi/git-paging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit-paging-alias.txt
More file actions
35 lines (35 loc) · 1.33 KB
/
git-paging-alias.txt
File metadata and controls
35 lines (35 loc) · 1.33 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
[alias]
hist = !"hist() { \
if test -z $1;then \
REMOTE=\"$(git remote)\"; \
params=\"${1:-$(git symbolic-ref \"refs/remotes/$REMOTE/HEAD\")}\"; \
else \
params=\"$@\"; \
fi; \
git log \
--color \
--graph \
--abbrev-commit \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<author:%an == commitor:%cn>%Creset' \
$params; \
};hist"
swc-first = !"first() { \
REMOTE=\"$(git remote)\"; \
branch=\"${1:-$(git symbolic-ref \"refs/remotes/$REMOTE/HEAD\")}\"; \
git switch --detach $(git log --reverse --pretty=%H \"$branch\" | head -1); \
};first"
swc-last = !"last(){ \
REMOTE=\"$(git remote)\"; \
branch=\"${1:-$(git symbolic-ref \"refs/remotes/$REMOTE/HEAD\")}\"; \
git switch --detach $(git log -n 1 --pretty=%H \"$branch\"); \
};last"
swc-prev = !"prev(){ \
n=\"${1:-1}\"; \
git checkout HEAD~$n; \
};prev"
swc-next = !"next(){ \
REMOTE=\"$(git remote)\"; \
branch=\"$(git symbolic-ref \"refs/remotes/$REMOTE/HEAD\")\"; \
n=\"${1:-1}\"; \
git switch --detach $(git log --reverse --pretty=%H \"$branch\" | grep -A $n $(git rev-parse HEAD) | tail -1); \
};next"