{"thread":{"id":"47682","subject":"Creating sparse checkout in a new linked git worktree","startedAt":"2018-01-24T16:29:54Z","lastAt":"2018-01-28T09:40:43Z","messageCount":3,"participants":["Jessie Hernandez","Eric Sunshine","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"337267","messageId":"54fd6a226955dc427bb25d5be37b4b0a.squirrel@mail.jessiehernandez.com","threadId":"47682","inReplyTo":null,"subject":"Creating sparse checkout in a new linked git worktree","fromName":"Jessie Hernandez","fromEmail":"git@jessiehernandez.com","sentAt":"2018-01-24T16:11:30Z","receivedAt":"2018-01-24T16:29:54Z","isPatch":false,"sender":{"key":"git@jessiehernandez.com","avatar":null},"body":"Hi All,\n\nI am trying to get a sparse checkout in a linked worktree but cannot get\nit working. I have tried the following\n\n* git worktree add /some/new/path/new-branch --no-checkout\n* git config core.sparseCheckout true\n* <add the directory I would like to checkout out to\n$GIT_DIR/info/sparse-checkout>\n* cd  /some/new/path/new-branch\n* git read-tree -mu sparse-checkout\n\nBut I still end up with a fully populated worktree.\n\nIs there something I am missing or doing wrong?\n\nthank you for any response.\n\njessie\n\n\n"},{"id":"337598","messageId":"CAPig+cSP0UiEBXSCi7Ua099eOdpMk8R=JtAjPuUavRF4z0R0Vg@mail.gmail.com","threadId":"47682","inReplyTo":"54fd6a226955dc427bb25d5be37b4b0a.squirrel@mail.jessiehernandez.com","subject":"Re: Creating sparse checkout in a new linked git worktree","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-01-28T07:25:40Z","receivedAt":"2018-01-28T07:28:03Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Jan 24, 2018 at 11:11 AM, Jessie Hernandez\n<git@jessiehernandez.com> wrote:\n> I am trying to get a sparse checkout in a linked worktree but cannot get\n> it working. I have tried the following\n>\n> * git worktree add /some/new/path/new-branch --no-checkout\n> * git config core.sparseCheckout true\n> * <add the directory I would like to checkout out to\n> $GIT_DIR/info/sparse-checkout>\n> * cd  /some/new/path/new-branch\n> * git read-tree -mu sparse-checkout\n>\n> But I still end up with a fully populated worktree.\n> Is there something I am missing or doing wrong?\n\nThe sparse-checkout file is specific to each worktree, which allows\nyou to control \"sparsity\" on a worktree by worktree basis. Therefore,\nyou should create $GIT_DIR/worktrees/<id>/info/sparse-checkout instead\n(where <id> is \"new-branch\" in your example).\n"},{"id":"337600","messageId":"CACsJy8D03LkoT38Xrz0xDUk=Uf=9O0XKrLG0vZMtBxowo9ibNA@mail.gmail.com","threadId":"47682","inReplyTo":"CAPig+cSP0UiEBXSCi7Ua099eOdpMk8R=JtAjPuUavRF4z0R0Vg@mail.gmail.com","subject":"Re: Creating sparse checkout in a new linked git worktree","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-01-28T09:40:06Z","receivedAt":"2018-01-28T09:40:43Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sun, Jan 28, 2018 at 2:25 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Wed, Jan 24, 2018 at 11:11 AM, Jessie Hernandez\n> <git@jessiehernandez.com> wrote:\n>> I am trying to get a sparse checkout in a linked worktree but cannot get\n>> it working. I have tried the following\n>>\n>> * git worktree add /some/new/path/new-branch --no-checkout\n>> * git config core.sparseCheckout true\n>> * <add the directory I would like to checkout out to\n>> $GIT_DIR/info/sparse-checkout>\n>> * cd  /some/new/path/new-branch\n>> * git read-tree -mu sparse-checkout\n>>\n>> But I still end up with a fully populated worktree.\n>> Is there something I am missing or doing wrong?\n>\n> The sparse-checkout file is specific to each worktree, which allows\n> you to control \"sparsity\" on a worktree by worktree basis. Therefore,\n> you should create $GIT_DIR/worktrees/<id>/info/sparse-checkout instead\n> (where <id> is \"new-branch\" in your example).\n\nNit. Do\n\n    $EDITOR `git rev-parse --git-path info/sparse-checkout`\n\nif you're already in the right worktree so you don't have to find out\nabout <id> or the full path.\n\nI wanted to add \"git checkout --edit-sparse\" for some time. Using it\nin multiple worktrees may be a good push for me to eventually do it.\n-- \nDuy\n"}]}