git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Reverting a range of commits with conflict

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 2, 2019, 00:50 UTC
Message-ID
<xmqq36n1ut6f.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CACrt3pyZ7XNHLfFM46qymLYft4+jXSU_HBD2Wk+cL6MSzryFhA@mail.gmail.com>
Sam Lee <skynare@gmail.com> writes:
> It brings up EDITOR twice and I end up with two commits.
> I can squash them. But, I don't know if this is a desired behavior.

It is my understanding that the users who do want a single revert of multiple commits are expected to squash them (by choosing which ones to squash into one), so if you really want to make them into one, you can squash them and that is your desired behaviour. The point is that you do not have to.

If you think a bit about it, it does not make much sense to leave outstanding changes in limbo with --no-commit when you are picking or reverting multiple commits. The first one may replay cleanly or may not and needs manual resolution, but after that, the work you did will only be in your working tree, and the difference between that and the HEAD and the index is not recorded anywhere else. What happens when the replaying (either cherry-picking or reverting) of the second one had conflict? The effect of picking or reverting the first one is now intermingled with the effect of the conflicted picking or reverting of the second---with --no-commit, the workflow is making the messy conflicted state needlessly larger.

Previous: Sam Lee
Message 2 of 2 in “Reverting a range of commits with conflict”
  1. Sam LeeApr 1, 2019
  2. Junio C HamanoApr 2, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.