On Fri, Mar 22, 2013 at 5:28 PM, Kirill Müller
<kirill.muel...@ivt.baug.ethz.ch> wrote:
> I can't find a neat way to "git reset --hard" a subdirectory of a checkout
> without reading in directories or files which are excluded by a sparse
> checkout. This has been asked on StackOverflow in greater detail, but the
> "right" answer is still missing: http://stackoverflow.com/q/15404535/946850
> The options I see are:
> - git checkout . (will restore excluded directories)
> - git reset --hard (won't accept a path argument)
> - git diff | patch -R (awkward)

Another way is

git diff --name-only -z|xargs -0 git checkout

> What's the proper way to do this in Git?

I think adding --sparse to git checkout may be more user-friendly. And
it looks like a simple change. I'll make a patch soon (I need some
time to recall how sparse checkout interacts with git-checkout).
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to