git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge
@ 2024-06-24 10:17 Noam Yorav-Raphael
  2024-06-25  9:03 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Yorav-Raphael @ 2024-06-24 10:17 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-26 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 10:17 Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge Noam Yorav-Raphael
2024-06-25  9:03 ` Junio C Hamano
2024-06-26 12:17   ` Noam Yorav-Raphael

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).