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

Re: Sparse checkout in worktree

From
Duy Nguyen <pclouds@gmail.com>
Date
Nov 25, 2015, 19:38 UTC
Message-ID
<CACsJy8Acb0Z3sw7_r6QfTTz=GqedsU76QxjexWf4yZFg9O7W-w@mail.gmail.com>
In-Reply-To
<5655AC29.20801@drmicha.warpmail.net>

On Wed, Nov 25, 2015 at 1:40 PM, Michael J Gruber <git@drmicha.warpmail.net> wrote:

Show 6 quoted lines
> Hi there,
>
> I'm wondering how much it would take to enable worktree specific sparse
> checkouts. From a superfluous look:
>
> - $GIT_DIR/info/sparse_checkout needs to be worktree specific
It already is.
Show 8 quoted lines
> - We don't have much tooling around sparse to speak of at all.
>
> The endgoal would be to have something like
>
> git checkout [--sparse <pattern>]...
>
> which sets up the sparse_checkout file and "git worktree" to pass any
> --sparse option on to "git checkout"

Or.. convert pathspec specified at 'git-checkout' (or git-worktree) into sparse patterns. For example,

git worktree add --sparse some-path branch --  foo/

will automatically create sparse-checkout file that limits to 'foo'. Not easy (and in some cases probably impossible), but it's more intuitive. .

> While in an ideal world we all have micro repos, in the real world we
> often have larger repos with mostly independent subdirs. For a quick fix
> on a side branch in a subdir, a new sparse worktree would be an ideal
> lean solution.

Sparse checkout should eventually be replaced with something better that does not keep full tree in index, but I don't think anybody is working on that..

> As it is, "git stash save && git checkout" is leaner but interrupts the
> workflow more, and a local "git clone" with links and alternates is
> leaner, too, but conceptually overkill if you want to work quickly on an
> existing side branch.

-- Duy

Previous: Michael J GruberNext: Michael J Gruber
Message 2 of 6 in “Sparse checkout in worktree”
  1. Michael J GruberNov 25, 2015
  2. Duy NguyenNov 25, 2015
  3. Michael J GruberNov 25, 2015
  4. Duy NguyenNov 25, 2015
  5. Michael J GruberNov 25, 2015
  6. Duy NguyenNov 25, 2015

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.