{"thread":{"id":"50856","subject":"Reverting a range of commits with conflict","startedAt":"2019-04-01T17:26:37Z","lastAt":"2019-04-02T00:50:20Z","messageCount":2,"participants":["Sam Lee","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"372921","messageId":"CACrt3pyZ7XNHLfFM46qymLYft4+jXSU_HBD2Wk+cL6MSzryFhA@mail.gmail.com","threadId":"50856","inReplyTo":null,"subject":"Reverting a range of commits with conflict","fromName":"Sam Lee","fromEmail":"skynare@gmail.com","sentAt":"2019-04-01T17:25:54Z","receivedAt":"2019-04-01T17:26:37Z","isPatch":false,"sender":{"key":"skynare@gmail.com","avatar":null},"body":"Given:\n    A-B-C-D-E (HEAD)\nI want to create a single commit that reverts A-B-C\n\nSo, I execute:\n    git revert --no-commit A~..C\nwhich causes conflict (while reverting C, it seems).\n\nI resolve conflicts and I continue:\n    git revert --continue --no-commit\nAnd, it complains:\n    fatal: revert: --no-commit cannot be used with --continue\n\nIf I revert --continue without --no-commit:\n    git revert --continue\n\nIt brings up EDITOR twice and I end up with two commits.\nI can squash them. But, I don't know if this is a desired behavior.\n\nShould I be able to revert --continue with --no-commit?\nShould revert --continue remember that initial revert invocation was\nwith --no-commit option?\n\nThanks.\n"},{"id":"372956","messageId":"xmqq36n1ut6f.fsf@gitster-ct.c.googlers.com","threadId":"50856","inReplyTo":"CACrt3pyZ7XNHLfFM46qymLYft4+jXSU_HBD2Wk+cL6MSzryFhA@mail.gmail.com","subject":"Re: Reverting a range of commits with conflict","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-04-02T00:50:16Z","receivedAt":"2019-04-02T00:50:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Lee <skynare@gmail.com> writes:\n\n> It brings up EDITOR twice and I end up with two commits.\n> I can squash them. But, I don't know if this is a desired behavior.\n\nIt is my understanding that the users who do want a single revert of\nmultiple commits are expected to squash them (by choosing which ones\nto squash into one), so if you really want to make them into one,\nyou can squash them and that is your desired behaviour.  The point\nis that you do not have to.\n\nIf you think a bit about it, it does not make much sense to leave\noutstanding changes in limbo with --no-commit when you are picking\nor reverting multiple commits.  The first one may replay cleanly or\nmay not and needs manual resolution, but after that, the work you\ndid will only be in your working tree, and the difference between\nthat and the HEAD and the index is not recorded anywhere else.  What\nhappens when the replaying (either cherry-picking or reverting) of\nthe second one had conflict?  The effect of picking or reverting the\nfirst one is now intermingled with the effect of the conflicted\npicking or reverting of the second---with --no-commit, the workflow\nis making the messy conflicted state needlessly larger.\n\n"}]}