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

Re: [BUG?] git checkout $commit -- somedir doesn't drop files

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 17, 2013, 22:00 UTC
Message-ID
<xmqqk3ifw1km.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20130917212106.GB20178@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 8 quoted lines
> On Tue, Sep 17, 2013 at 01:40:17PM -0700, Junio C Hamano wrote:
>
>> Taking the state of a subdirectory as a whole as "content", the
>> change we are discussing will make it more like "rm -fr dir && tar
>> xf some-content dir" to replace the directory wholesale, which I
>> personally think is a good thing in the longer term.
>
> Yeah, that makes sense. What about untracked files?

Obviously we cannot literally do "rm -fr dir && tar x", but I agree that if tree-ish has a path that is not tracked in the current index, the path should be overwritten and made identical to what is in the tree-ish.

Show 7 quoted lines
> Right now we overwrite them if the tree-ish has an entry at the same
> path; that is a bit more dangerous than the rest of git, but does match
> the "ignore local modifications" rule. I assume if we handled deletions,
> though, that we would simply leave them be.
>
> So given that, is it fair to say that a one-way "go here" merge, limited
> by pathspec, is the closest equivalent?

Sorry, but it is unclear to me what you mean by one-way "go here" merge. Do you mean oneway_merge() in unpack-trees.c?

Previous: Jeff KingNext: Jeff King
Message 8 of 15 in “[BUG?] git checkout $commit -- somedir doesn't drop files”
  1. Uwe Kleine-KönigSep 17, 2013
  2. Junio C HamanoSep 17, 2013
  3. Jeff KingSep 17, 2013
  4. Junio C HamanoSep 17, 2013
  5. Jeff KingSep 17, 2013
  6. Junio C HamanoSep 17, 2013
  7. Jeff KingSep 17, 2013
  8. Junio C HamanoSep 17, 2013
  9. Jeff KingSep 17, 2013
  10. Junio C HamanoSep 17, 2013
  11. Jeff KingSep 19, 2013
  12. Junio C HamanoSep 19, 2013
  13. Jeff KingSep 19, 2013
  14. Junio C HamanoSep 20, 2013
  15. Jeff KingSep 17, 2013

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.