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

Re: git-checkout changes the index but not the checked out files?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Apr 23, 2007, 14:53 UTC
Message-ID
<alpine.LFD.0.98.0704230747110.9964@woody.linux-foundation.org>
In-Reply-To
<46a038f90704221745h1bf2955cyfb40f6e8c08a336d@mail.gmail.com>
On Mon, 23 Apr 2007, Martin Langhoff wrote:
> 
> The _really_ strange bit is that it was attempting to merge 2 heads of
> the same name. It'd probably be something to block...

No, "git-read-tree -m A B" is not a "merge" in the sense you're thinking, it's a "fast-forward merge", ie just a "move from A to B"

So read-tree has three "merges": a one-way merge (which just merges with the old index _stat_ contents but otherwise just reads in the new tree), a two-way merge (a "move from A to B") that checks that all paths that are different in the two trees match the index in the old one, and the "real" merge, aka the three-way thing (and even that is actially "four-way", since it also checks the index for matchingness)

So when we move from one head to another, we do that two-way thing. And if A and B are the same, doesn't really do anything, but there's also no point to try to avoid doing it.

		Linus
Previous: Martin LanghoffNext: Martin Langhoff
Message 6 of 8 in “git-checkout changes the index but not the checked out files?”
  1. Martin LanghoffApr 22, 2007
  2. Junio C HamanoApr 22, 2007
  3. Martin LanghoffApr 23, 2007
  4. Junio C HamanoApr 23, 2007
  5. Martin LanghoffApr 23, 2007
  6. Linus TorvaldsApr 23, 2007
  7. Martin LanghoffApr 23, 2007
  8. Uwe Kleine-KönigApr 23, 2007

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.