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

Re: Odd merge behaviour involving reverts

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 19, 2008, 00:21 UTC
Message-ID
<alpine.LFD.2.00.0812181614070.14014@localhost.localdomain>
In-Reply-To
<1229645511.5770.29.camel@rotwang.fnordora.org>
On Thu, 18 Dec 2008, Alan wrote:
> 
> I think I know how to fix it.  I am just concerned about having it occur
> again if someone else makes the same mistake I did.

I suspect we should warn about reverting merges. I'm surprised we don't already. Reverting a merge isn't "wrong", but it's a whole lot more subtle than reverting a regular commit.

Reverting a regular commit just effectively undoes what that commit did, and is fairly straightforward. But reverting a merge commit also undoes the _data_ that the commit changed, but it does absolutely nothing to the effects on _history_ that the merge had.

So the merge will still exist, and it will still be seen as joining the two branches together, and future merges will see that merge as the last shared state - and the revert that reverted the merge brought in will not affect that at all.

So a "revert" undoes the data changes, but it's very much _not_ an "undo" in the sense that it doesn't undo the effects of a commit on the repository history.

So if you think of "revert" as "undo", then you're going to always miss this part of reverts. Yes, it undoes the data, but no, it doesn't undo history.

			Linus
Previous: AlanNext: Alan
Message 4 of 17 in “Odd merge behaviour involving reverts”
  1. AlanDec 18, 2008
  2. Linus TorvaldsDec 18, 2008
  3. AlanDec 19, 2008
  4. Linus TorvaldsDec 19, 2008
  5. AlanDec 19, 2008
  6. Linus TorvaldsDec 19, 2008
  7. Nanako ShiraishiDec 19, 2008
  8. Linus TorvaldsDec 19, 2008
  9. Jay SoffianDec 19, 2008
  10. Linus TorvaldsDec 19, 2008
  11. Daniel BarkalowDec 19, 2008
  12. Junio C HamanoDec 19, 2008
  13. Nanako ShiraishiDec 19, 2008
  14. Junio C HamanoDec 19, 2008
  15. Nanako ShiraishiDec 19, 2008
  16. Junio C HamanoDec 19, 2008
  17. Boyd Stephen Smith Jr.Dec 19, 2008

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.