git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Creating sparse checkout in a new linked git worktree

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jan 28, 2018, 07:25 UTC
Message-ID
<CAPig+cSP0UiEBXSCi7Ua099eOdpMk8R=JtAjPuUavRF4z0R0Vg@mail.gmail.com>
In-Reply-To
<54fd6a226955dc427bb25d5be37b4b0a.squirrel@mail.jessiehernandez.com>

On Wed, Jan 24, 2018 at 11:11 AM, Jessie Hernandez <git@jessiehernandez.com> wrote:

Show 12 quoted lines
> 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).

Previous: Jessie HernandezNext: Duy Nguyen
Message 2 of 3 in “Creating sparse checkout in a new linked git worktree”
  1. Jessie HernandezJan 24, 2018
  2. Eric SunshineJan 28, 2018
  3. Duy NguyenJan 28, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.