From: Junio C Hamano Date: Tue, 17 Sep 2013 22:00:41 GMT Subject: Re: [BUG?] git checkout $commit -- somedir doesn't drop files Message-ID: In-Reply-To: <20130917212106.GB20178@sigill.intra.peff.net> Jeff King writes: > 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. > 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?