git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Noam Yorav-Raphael <noamraph@gmail.com>
To: git@vger.kernel.org
Subject: Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge
Date: Mon, 24 Jun 2024 13:17:25 +0300	[thread overview]
Message-ID: <CAO8o=D5womGcsVsGT4h2=3qry05mMrd9dFDkZHrLtPCDw0+2Tg@mail.gmail.com> (raw)

Hi,

I was looking for a way to revert a merge, and found the document at
howto/revert-a-faulty-merge.txt. It basically suggests that if you
reverted a merge and want to re-merge, you should first revert the
revert.

This is fine, but it means that you must remember to revert the revert
before the next merge, which may be hard to remember. I thought of
another solution: In the source branch, add a commit reverting all the
changes since the previous merge, then merge again from that brange to
the master branch, and then revert the revert. In a diagram:

----o---o---o---M---o---o------------W-------
       /       /                    /
------o---A---B---C-------!C!B!A---o----ABC--

(`!C!B!A` means a commit that reverts C, B and A, returning to `o`.
`ABC` means a commit that applies A, B and C, thus returning to the
tree after C.)

Now the W commit really reverts the M commit, and you can forget about it.

Would you be interested in a patch adding this to
howto/revert-a-faulty-merge.txt?

Thanks,
Noam

             reply	other threads:[~2024-06-24 10:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 10:17 Noam Yorav-Raphael [this message]
2024-06-25  9:03 ` Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge Junio C Hamano
2024-06-26 12:17   ` Noam Yorav-Raphael

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='CAO8o=D5womGcsVsGT4h2=3qry05mMrd9dFDkZHrLtPCDw0+2Tg@mail.gmail.com' \
    --to=noamraph@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).