threads / discuss / 52718

How to undo git sparse-checkout set only for one directory?

Subject: How to undo git sparse-checkout set only for one directory?

## tl;dr

2 messages between Jan 30, 2020 and Jan 30, 2020.

replies: 1people: 2as markdown or json

dk@tutunak.com· Jan 30, 2020, 14:56 UTC · lore
After git sparse-checkout set <dir1> <dir2> <dir3> I want to disable sparse checkout only for one directroy - <dir2>. How can I do that? git sparse-checkout disable will do that for whole repository. 
Derrick Stolee· Jan 30, 2020, 15:08 UTC · re: dk@tutunak.com · lore

Re: How to undo git sparse-checkout set only for one directory?

On 1/30/2020 9:56 AM, dk@tutunak.com wrote:
> After git sparse-checkout set <dir1> <dir2> <dir3> I want to disable sparse checkout only for one directroy - <dir2>. How can I do that? git sparse-checkout disable will do that for whole repository. 

I'm planning to add some "add" and "remove" subcommands to the sparse-checkout builtin soon, and those would allow you to modify the sparse-checkout cone one-by-one.

For the case you have now, you can try this:
	git sparse-checkout list >dirs.txt
	(edit dirs.txt to remove the directory you do not want)
	git sparse-checkout set --stdin <dirs.txt
Alternatively, you could do this abomination:
	git sparse-checkout list | grep -v "<dir2>" | git sparse-checkout set --stdin
I hope that helps.

Thanks, -Stolee

← back to recent threads