mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-26 20:31:15 +01:00
feat(git): add gunwipall
function (#11725)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
parent
d1c64bfda3
commit
115cee1701
2 changed files with 15 additions and 0 deletions
|
@ -254,6 +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 |
|
| work_in_progress | Echoes a warning if the current branch is a wip |
|
||||||
| gwip | Commit wip branch |
|
| gwip | Commit wip branch |
|
||||||
| gunwip | Uncommit wip branch |
|
| gunwip | Uncommit wip branch |
|
||||||
|
| gunwipall | Uncommit `--wip--` commits recursively |
|
||||||
|
|
||||||
### Deprecated functions
|
### Deprecated functions
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,20 @@ function work_in_progress() {
|
||||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Check if main exists and use instead of master
|
# Check if main exists and use instead of master
|
||||||
function git_main_branch() {
|
function git_main_branch() {
|
||||||
command git rev-parse --git-dir &>/dev/null || return
|
command git rev-parse --git-dir &>/dev/null || return
|
||||||
|
|
Loading…
Reference in a new issue