Re: [PATCH] fetch: add config to avoid fetching every branch in shallow repo
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Sep 21, 2026, 21:45 UTC
- Message-ID
- <CAHwyqnWbbCK40qAU1vhCFmN86J-dCY3tv_N_nBYgK2Bxf3o1fg@mail.gmail.com>
- In-Reply-To
- <7f084e4d-f738-4bd4-9b4d-cad995f04be8@gmail.com>
On Mon, Sep 21, 2026 at 3:28 PM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 14 quoted lines
> > Hi Harald > > On 19/09/2026 15:47, Harald Nordgren via GitGitGadget wrote: > > From: Harald Nordgren <haraldnordgren@gmail.com> > > > > In a shallow, sparsely checked out clone of a repository with many > > branches, plain git pull can take minutes or hang outright, even > > though only one branch is actually being worked on. > > I think the sparse checkout is irrelevant? It is unclear to me if this > is talking about a case where there are many branches in the remote > repository and only one of them was cloned, then adding a second remote > created a wildcard fetch refspec
Yeah likely. I cloned my fork of homebrew-core with `--depth=1` and then added real upstream as a remote. Then I made my work on a feature branch.
Then tried to set my branch to track upstream, but it didn't work.
Then 'git pull' and it hung.
> If it is the former then we should think > how we can improve the behavior of "git remote add" in a sparse > repository to prevent it adding a wildcard fetch refspec and instead > setup the new remote to fetch only the branch(es) we're interested in.
I didn't even consider that, that sounds like an interesting idea!
Harald