From: Duy Nguyen Date: Sun, 28 Jan 2018 09:40:06 GMT Subject: Re: Creating sparse checkout in a new linked git worktree Message-ID: In-Reply-To: On Sun, Jan 28, 2018 at 2:25 PM, Eric Sunshine wrote: > On Wed, Jan 24, 2018 at 11:11 AM, Jessie Hernandez > wrote: >> I am trying to get a sparse checkout in a linked worktree but cannot get >> it working. I have tried the following >> >> * git worktree add /some/new/path/new-branch --no-checkout >> * git config core.sparseCheckout true >> * > $GIT_DIR/info/sparse-checkout> >> * cd /some/new/path/new-branch >> * git read-tree -mu sparse-checkout >> >> But I still end up with a fully populated worktree. >> Is there something I am missing or doing wrong? > > The sparse-checkout file is specific to each worktree, which allows > you to control "sparsity" on a worktree by worktree basis. Therefore, > you should create $GIT_DIR/worktrees//info/sparse-checkout instead > (where is "new-branch" in your example). Nit. Do $EDITOR `git rev-parse --git-path info/sparse-checkout` if you're already in the right worktree so you don't have to find out about or the full path. I wanted to add "git checkout --edit-sparse" for some time. Using it in multiple worktrees may be a good push for me to eventually do it. -- Duy