Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
f5cb9a6c
Unverified
Commit
f5cb9a6c
authored
Jun 17, 2023
by
Ihor
Committed by
GitHub
Jun 17, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(git): `gunwipall` now only resets once (#11758)
Closes #11750 Co-authored-by:
Carlo Sala
<
carlosalag@protonmail.com
>
parent
42b86327
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
README.md
plugins/git/README.md
+1
-1
git.plugin.zsh
plugins/git/git.plugin.zsh
+6
-10
No files found.
plugins/git/README.md
View file @
f5cb9a6c
...
...
@@ -254,7 +254,7 @@ These features allow to pause a branch development and switch to another one (_"
| work_in_progress | Echoes a warning if the current branch is a wip |
| gwip | Commit wip branch |
| gunwip | Uncommit wip branch |
| gunwipall | Uncommit
`--wip--`
commits recursively
|
| gunwipall | Uncommit
all recent
`--wip--`
commits
|
### Deprecated functions
...
...
plugins/git/git.plugin.zsh
View file @
f5cb9a6c
...
...
@@ -27,18 +27,14 @@ function work_in_progress() {
command
git
-c
log.showSignature
=
false
log
-n
1 2>/dev/null |
grep
-q
--
"--wip--"
&&
echo
"WIP!!"
}
# Same as `gunwip` but recursive
# "Unwips" all recent `--wip--` commits in loop until there is no left
# Similar to `gunwip` but recursive "Unwips" all recent `--wip--` commits not just the last one
function
gunwipall
()
{
while
true
;
do
commit_message
=
$(
git rev-list
--max-count
=
1
--format
=
"%s"
HEAD
)
if
[[
$commit_message
=
~
"--wip--"
]]
;
then
git reset
"HEAD~1"
((
$?
))
&&
return
1
else
break
local
_commit
=
$(
git log
--grep
=
'--wip--'
--invert-grep
--max-count
=
1
--format
=
format:%H
)
# Check if a commit without "--wip--" was found and it's not the same as HEAD
if
[[
"
$_commit
"
!=
"
$(
git rev-parse HEAD
)
"
]]
;
then
git reset
$_commit
||
return
1
fi
done
}
# Check if main exists and use instead of master
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment