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

[RFC] Not grabbing ALL branches and tags with git clone

From
CBCarl Baldwin <cnb@fc.hp.com>
Date
Nov 14, 2005, 18:26 UTC
Message-ID
<20051114182616.GB19105@hpsvcnb.fc.hp.com>
Greetings,

Lately, I've found that 'git clone' gives me more than what I want. Especially when there are a lot of branches and tags in the remote repository.

I have found myself doing something like the following in most cases.

% mkdir work && cd work % git init-db % git fetch <url> <refspec> % git checkout -f -b master <branch>

Usually, I will use a file in .git/remotes but you get the idea. I was thinking that it might make sense to make git clone able to do this. Change the usage of git clone so that it looks like this:

git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir> [<refspec>] ...

git clone would behave exactly the same way if no refspec were given but if a refspec (or multiple refspecs) were given on the command line then git clone would behave more like my series of three commands above.

I haven't looked at what it would take to patch git clone for this purpose. Just wanted to see what you thought.

Cheers, Carl

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Carl Baldwin                        Systems VLSI Laboratory
 Hewlett Packard Company
 MS 88                               work: 970 898-1523
 3404 E. Harmony Rd.                 work: Carl.N.Baldwin@hp.com
 Fort Collins, CO 80525              home: Carl@ecBaldwin.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Next: Junio C Hamano
Message 1 of 2 in “[RFC] Not grabbing ALL branches and tags with git clone”
  1. Carl BaldwinNov 14, 2005
  2. Junio C HamanoNov 14, 2005

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.