fb4213c34ff8ec83cbe6251f432fdac383378562
- Author
- Tom D <noreplygitemail@protonmail.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
perf(git): improve `gunwip` alias (#11714)
Diff
1diff --git a/plugins/git/README.md b/plugins/git/README.md
2index f87d3fbca0756de16a79ad915ef8c26783bdbd96..2742aa5393331b7cc5ae6dca8b8f4cab495c3225 100644
3--- a/plugins/git/README.md
4+++ b/plugins/git/README.md
5@@ -186,7 +186,7 @@ plugins=(... git)
6 | gtv | git tag \| sort -V |
7 | gtl | gtl(){ git tag --sort=-v:refname -n --list ${1}\* }; noglob gtl |
8 | gunignore | git update-index --no-assume-unchanged |
9-| gunwip | git log --max-count=1 \| grep -q -c "\-\-wip\-\-" && git reset HEAD~1 |
10+| gunwip | git rev-list --max-count=1 --format="%s" HEAD \| grep -q "\-\-wip\-\-" && git reset HEAD~1 |
11 | gup | git pull --rebase |
12 | gupv | git pull --rebase --verbose |
13 | gupa | git pull --rebase --autostash |
14diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
15index 3c8d53c8c6a58bd580f881f960dfd1da14f96d79..4be865f6af92190a0019890e79e42f049fab6186 100644
16--- a/plugins/git/git.plugin.zsh
17+++ b/plugins/git/git.plugin.zsh
18@@ -312,7 +312,7 @@ alias gtv='git tag | sort -V'
19 alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl'
20
21 alias gunignore='git update-index --no-assume-unchanged'
22-alias gunwip='git log --max-count=1 | grep -q -c "\--wip--" && git reset HEAD~1'
23+alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
24 alias gup='git pull --rebase'
25 alias gupv='git pull --rebase --verbose'
26 alias gupa='git pull --rebase --autostash'