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

Re: expensive local git clone

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 6, 2005, 00:42 UTC
Message-ID
<Pine.LNX.4.58.0507051721450.3570@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.58.0507041327580.3570@g5.osdl.org>
On Mon, 4 Jul 2005, Linus Torvalds wrote:
> 
> I'm making something based on pack-files.

Ok, as of a few minutes ago there's now a pack-based "git clone" there. Of course, it hasn't percolated out to the mirrors yet, so you'll not see it for a while unless you have a master.kernel.org account like David, but basically you can do

	git clone /some/absolute/path new-dir

and it will clone the old project into new-dir using pack-files. The need for an absolute path in the source is just because the "git clone" script ends up "cd'ing" to the new directory before the clone, so a relative path would need to be relative to the "new-dir" location, which is just confusing. Oh, well.

Anyway, as mentioned, you can certainly do a local clone a lot faster with "cp -rl" (and yes, I'll apply Junio's patch if he makes it available against the new version, and adds a flag to make it conditional), but using a pack-file means that the new thing not only will be totally independent of the old one (which you may _want_ to do, especially if they are on different filesystems), but it also means that the above works over ssh too, ie

	git clone master.kernel.org:/pub/scm/git/git.git my-git

should now do the right thing (indeed, I've even tested it - although I've not tried it with things like multiple branches etc, which _should_ all work automatically but.. I'm pulling Jeff's tree as I write this, but master.kernel.org is slow, so it will be some time..).

Btw, one small note: when doing a "git clone", the newly cloned repo will not be checked out, and "master" will be the default HEAD regardless of what the other happened to be at (unless the other side was really screwed up and we can't match up any "master" at all). So use "git checkout xxx" to actually set whatever branch you want to use after a clone.

		Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 14 in “expensive local git clone”
  1. David S. MillerJul 4, 2005
  2. Linus TorvaldsJul 4, 2005
  3. Petr BaudisJul 4, 2005
  4. David S. MillerJul 4, 2005
  5. Junio C HamanoJul 4, 2005
  6. David S. MillerJul 4, 2005
  7. Junio C HamanoJul 4, 2005
  8. Linus TorvaldsJul 4, 2005
  9. Short-cut git-fetch-pack while cloning locally.Junio C Hamano, Jul 5, 2005
  10. Linus TorvaldsJul 6, 2005
  11. Short-circuit git-clone-pack while cloning locally.Junio C Hamano, Jul 6, 2005
  12. Linus TorvaldsJul 6, 2005
  13. Junio C HamanoJul 6, 2005
  14. Short-circuit git-clone-pack while cloning locally (take 2).Junio C Hamano, Jul 6, 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.