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

Re: [PATCH] Add --track option to git clone

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Nov 30, 2009, 13:36 UTC
Message-ID
<4B13CA68.70708@drmicha.warpmail.net>
In-Reply-To
<1259587004-14633-1-git-send-email-sn_@gmx.net>
David Soria Parra venit, vidit, dixit 30.11.2009 14:16:
Show 10 quoted lines
> The following series adds a --track option to git clone. If the --track option
> is specified only the given remote branch will be received and checked out.
> 
> It tries to make the following usecase possible:
> Imagine you are working on a project that has 1.x and a 2.x branch. The project
> itself requires a complex setup (webserver, configuration files, etc). Setting up
> 1.x and 2.x branch requires a lot of work, but a developer needs to maintain both.
> He'll use the --track option to clone the 2.x branch into a directory and does the same
> with the 1.x branch, where he setup the project. He can use locally separate repositories
> while still being able to push to just one remote repository.

While I think the feature itself is useful, I don't think it's that useful for the case you mention. If you clone all branches anyways you're much better of using alternates or --reference, or the workdir script in contrib/

Show 6 quoted lines
> I'm aware that it's not possible to give more than one --track option. Implementing
> the possibility to specify multiple --track option would certainly a good improvment
> later, but would also require a lot more work as far as I understand the clone code.
> 
> Being able to specify just one --track option is a compromise of doing a small change
> and implementing this feature.
That restriction makes a lot of sense. Two suggestions:
- How does one turn such a "partial" clone into a full one? That should
be documented somewhere (git config remote.origin.fetch
'+refs/heads/*:refs/remotes/origin/*').
- A test would be nice, which makes sure you clone what you think you clone.

Cheers, Michael

Previous: David Soria Parra
Message 4 of 4 in “Add --track option to git clone”
  1. Add --track option to git cloneDavid Soria Parra, Nov 30, 2009
  2. 1/2 Teach clone to clone just one remote branch using --trackDavid Soria Parra, Nov 30, 2009
  3. 2/2 Documentation: Add --track option to the git clone manpageDavid Soria Parra, Nov 30, 2009
  4. Michael J GruberNov 30, 2009

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.