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

Re: Comments on Presentation Notes Request.

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Jan 8, 2009, 00:28 UTC
Message-ID
<alpine.LNX.1.00.0901071914490.19665@iabervon.org>
In-Reply-To
<200901071640.06288.bss@iguanasuicide.net>
On Wed, 7 Jan 2009, Boyd Stephen Smith Jr. wrote:
Show 7 quoted lines
> On Wednesday 2009 January 07 16:30:04 Daniel Barkalow wrote:
> > Git is clever about finding [...]
> > the common ancestor of commits that don't have a common ancestor.
> 
> *confused*
> 
> Please elaborate.

I meant to say "a *unique* closest common ancestor". The clever trick is that, if there are multiple common ancestors which aren't closer than each other, you can merge those ancestors (based, recursively, on their common ancestors) to generate a new commit with merge conflicts in it. You then pretend that this commit is the unique common ancestor for 3-way merge. This works because the merge conflicts in the commit all seem to have been replaced in each branch, and the conflict region is some arbitrary chunk of text in between other context, and the 3-way merge output doesn't show the original text (which would be weird junk in this case: a merge conflict that didn't really happen in the middle of other merge conflicts), but only the text from the two sides being merged, so it's not necessary to resolve the old merge that didn't happen.

I think all of the other systems, if you have crossing history such that there isn't a unique common ancestor do one of: (a) give up, (b) generate conflicts between your change as it stayed in your branch and the same change as it went out and came back, or (c) mishandle some cases involving reverts.

	-Daniel
*This .sig left intentionally blank*
Previous: Boyd Stephen Smith Jr.Next: Jeff King
Message 5 of 10 in “Comments on Presentation Notes Request.”
  1. Tim VisherJan 6, 2009
  2. Jeff KingJan 7, 2009
  3. Daniel BarkalowJan 7, 2009
  4. Boyd Stephen Smith Jr.Jan 7, 2009
  5. Daniel BarkalowJan 8, 2009
  6. Jeff KingJan 8, 2009
  7. david@lang.hmJan 7, 2009
  8. Tim VisherJan 7, 2009
  9. Daniel BarkalowJan 8, 2009
  10. Jakub NarebskiJan 9, 2009

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.