# Re: Creating sparse checkout in a new linked git worktree

3 messages from 2018-01-30 to 2018-01-31. Participants: Jessie Hernandez, Eric Sunshine.
Thread: https://gitlist.dev/t/47720

## Jessie Hernandez, 2018-01-30 14:25

Subject: Re: Creating sparse checkout in a new linked git worktree
Message-ID: <615c04025165d0dff9d6e6b66bf11a41.squirrel@mail.jessiehernandez.com>
URL: https://gitlist.dev/e/615c04025165d0dff9d6e6b66bf11a41.squirrel%40mail.jessiehernandez.com

```
> On Wed, Jan 24, 2018 at 11:11 AM, Jessie Hernandez
> <git@jessiehernandez.com> 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
>> * <add the directory I would like to checkout out to
>> $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/<id>/info/sparse-checkout instead
(where <id> is "new-branch" in your example).

Right this seems to work indeed.
Thank you.

Would it help if this was added to the documentation of git-read-tree

Regards,
Jessie





```

## Eric Sunshine, 2018-01-30 19:00

Subject: Re: Creating sparse checkout in a new linked git worktree
Message-ID: <CAPig+cRiyterpyJfayVmA5Ra_zzyVp6GGSNqe2Tx-Hrrif+U8A@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcRiyterpyJfayVmA5Ra_zzyVp6GGSNqe2Tx-Hrrif%2BU8A%40mail.gmail.com
In-Reply-To: <615c04025165d0dff9d6e6b66bf11a41.squirrel@mail.jessiehernandez.com>

```
On Tue, Jan 30, 2018 at 9:25 AM, Jessie Hernandez
<git@jessiehernandez.com> wrote:
>> 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/<id>/info/sparse-checkout instead
> (where <id> is "new-branch" in your example).
>
> Would it help if this was added to the documentation of git-read-tree

It probably would. Would you be interested in submitting a patch
(mentioning 'git rev-parse --git-path info/sparse-checkout', as
suggested by Duy)?

```

## Jessie Hernandez, 2018-01-31 10:03

Subject: Re: Creating sparse checkout in a new linked git worktree
Message-ID: <cb45d936ebc51f852ec50baf9d5e89a3.squirrel@mail.jessiehernandez.com>
URL: https://gitlist.dev/e/cb45d936ebc51f852ec50baf9d5e89a3.squirrel%40mail.jessiehernandez.com
In-Reply-To: <CAPig+cRiyterpyJfayVmA5Ra_zzyVp6GGSNqe2Tx-Hrrif+U8A@mail.gmail.com>

```
> On Tue, Jan 30, 2018 at 9:25 AM, Jessie Hernandez
> <git@jessiehernandez.com> wrote:
>>> 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/<id>/info/sparse-checkout instead
>> (where <id> is "new-branch" in your example).
>>
>> Would it help if this was added to the documentation of git-read-tree
>
> It probably would. Would you be interested in submitting a patch
> (mentioning 'git rev-parse --git-path info/sparse-checkout', as
> suggested by Duy)?
>
Sure. I will give it a try.


```
