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

Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge

From
Noam Yorav-Raphael <noamraph@gmail.com>
Date
Jun 24, 2024, 10:17 UTC
Message-ID
<CAO8o=D5womGcsVsGT4h2=3qry05mMrd9dFDkZHrLtPCDw0+2Tg@mail.gmail.com>
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

Next: Junio C Hamano
Message 1 of 3 in “Regarding howto/revert-a-faulty-merge.txt - another way to revert a merge”
  1. Noam Yorav-RaphaelJun 24, 2024
  2. Junio C HamanoJun 25, 2024
  3. Noam Yorav-RaphaelJun 26, 2024

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.