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

Re: Automatic merge failed, fix up by hand

From
Linus Torvalds <torvalds@osdl.org>
Date
Aug 24, 2005, 00:48 UTC
Message-ID
<Pine.LNX.4.58.0508231733500.3317@g5.osdl.org>
In-Reply-To
<1124831571.13042.27.camel@firebird.lenb.worldpath.net>
On Tue, 23 Aug 2005, Len Brown wrote:
Show 6 quoted lines
>
> I'm having trouble using git for merging kernel trees.
> 
> git seems to manufacture conflicts in files that
> I never touched, and on some files it completely
> throws up its arms, see "Not handling case" below.
Cool.

You've found a case where git-merge-base finds what appears to be two equally good merge candidates, but they really aren't.

The merge candidates are 30e332f3307e9f7718490a706e5ce99f0d3a7b26 and 3edea4833a1efcd43e1dff082bc8001fdfe74b34.

To see this graphically, do:
	echo 30e332f3307e9f7718490a706e5ce99f0d3a7b26 > .git/refs/tags/selected-merge-base
	echo 3edea4833a1efcd43e1dff082bc8001fdfe74b34 > .git/refs/tags/other-merge-base
	echo 81065e2f415af6c028eac13f481fb9e60a0b487b > .git/refs/tags/linus-head
	echo 702c7e7626deeabb057b6f529167b65ec2eefbdb > .git/refs/tags/lenb-head
	gitk --all
and notice how the not-selected one is:
	Author: Antonino A. Daplas <adaplas@gmail.com>  2005-08-15 06:29:11
	Committer: Linus Torvalds <torvalds@g5.osdl.org>  2005-08-15 09:59:39
	Tags: not-selected
while the selected on is:
	Author: Luming Yu <luming.yu@intel.com>  2005-08-11 21:31:00
	Committer: Len Brown <len.brown@intel.com>  2005-08-15 12:46:58
	Tags: selected

and the reason we chose that one is that it's three hours later than the other one, and we don't know any better.

> Not clear how I got into this state -- probably
> something to do with adding commits on branches
> and them git-pull-branch'ing them into the master;
> combined with updating the master from-linus.
No, it's git.

Well, it's git, together with your propensity to merge old work, which causes this kind of confusion where there are two "equally good" points to choose from as the merge base, and git chose the wrong one because it _looked_ newer and there was a recent merge to an old version of my tree.

Cross-merges cause this, but I'm sure there's a good algorithm for selecting _which_ of the two interesting commits to pick.

Give me a moment to think about this.
		Linus
Previous: Len Brown
Message 12 of 12 in “Automatic merge failed, fix up by hand”
  1. Len BrownAug 23, 2005
  2. Junio C HamanoAug 23, 2005
  3. Len BrownAug 23, 2005
  4. Junio C HamanoAug 23, 2005
  5. Junio C HamanoAug 24, 2005
  6. Junio C HamanoAug 24, 2005
  7. Linus TorvaldsAug 24, 2005
  8. Junio C HamanoAug 24, 2005
  9. Len BrownAug 24, 2005
  10. Daniel BarkalowAug 24, 2005
  11. Len BrownAug 24, 2005
  12. Linus TorvaldsAug 24, 2005

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.