From: "Thomas Bétous" <th.betous@gmail.com>
To: git@vger.kernel.org
Subject: Bug Report: "git reset --hard" does not cancel an on-going rebase
Date: Mon, 31 Aug 2020 23:59:38 +0200 [thread overview]
Message-ID: <34B7EFB9-8710-4993-ACCD-604313D543E7@gmail.com> (raw)
Hello,
I would like to report an inconsistent behavior of the rebase/reset commands. I don’t know whether it is an actual bug or something else but according to me something is not right.
When a rebase gets paused (because of a conflict for instance) I would expect the command "git reset --hard" to cancel this on-going rebase but it does not.
I expect this because for instance "git reset --hard" cancels a cherry-pick in the same use case so I think the behavior of these 2 commands should be consistent.
The issue can be reproduced with the following commands:
# First trigger a rebase that will paused because of a conflict
# (there is probably a simpler way to end up in this use case)
$ git init test-repo-rebase-reset
$ cd test-repo-rebase-reset/
$ touch file
$ git add file
$ git commit file -m 'First commit’
$ echo "dummy line" > file
$ git commit --all -m 'Second commit’
$ git switch --create new-branch HEAD~1
$ git rm file
$ git commit -m 'Remove file’
$ git rebase master
# Let’s check that the rebase got paused because of the conflict
$ git status
$ git reset --hard
# Even after the “git reset --hard“ the rebase was not aborted
$ git status
# Now let’s check what happens with the cherry-pick command
$ git rebase --abort
$ git switch master
$ git cherry-pick $(git rev-parse -1 new-branch)
# The cherry-pick got paused because of the same conflict
git status
# Let’s try to abort the cherry-pick with the reset command
git reset --hard
# Double check the cherry-pick was aborted
git status
I think the behavior will be the same on all OS but if it helps I was able to reproduce it on Cygwin/Windows 10 with git 2.28.0 and Mac OS with git 2.26.0
Note that in the commands above I didn’t give any revision to the reset command but the issue would be the same if I did. Moreover it makes it even more confusing I think: you can move your HEAD to any revision while the rebase is still waiting to be completed.
What do you think? Does this behavior seems normal to you?
Thank you in advance for your answer.
Best regards,
Thomas
next reply other threads:[~2020-08-31 21:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 21:59 Thomas Bétous [this message]
2020-08-31 23:11 ` Bug Report: "git reset --hard" does not cancel an on-going rebase Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34B7EFB9-8710-4993-ACCD-604313D543E7@gmail.com \
--to=th.betous@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).