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

Re: checkout from neighbour branch undeletes a path?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 13, 2012, 16:43 UTC
Message-ID
<7v8va5fo7g.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20121113152341.GC6561@external.screwed.box>
Peter Vereshagin <peter@vereshagin.org> writes:
> Am wondering if 'checkout branch path' undeletes the files?

"git checkout branch path" (by the way, "branch" does not have to be a branch name; any commit object name would do, like "git checkout HEAD^^ hello.c") is a way to check out named path(s) out of the named commit.

If the commit "branch" has "path" in it, its contents are checked out to "path" in your current working tree (and the entry in the index updated to match it).

If you happen to have removed "path" in your current working tree before running that command, it might look as if there is some undelete going on, but that is a wrong way to look at things. The version of "path" in the "branch" may or may not be similar to what you have removed earlier.

Previous: Peter VereshaginNext: Peter Vereshagin
Message 2 of 4 in “checkout from neighbour branch undeletes a path?”
  1. Peter VereshaginNov 13, 2012
  2. Junio C HamanoNov 13, 2012
  3. Peter VereshaginNov 13, 2012
  4. Junio C HamanoNov 13, 2012

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.