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

Re: copying git repositories ...

From
Brian Gernhardt <benji@silverinsanity.com>
Date
Feb 28, 2011, 15:10 UTC
Message-ID
<43737C0D-E1B7-4036-BE39-8DF09751E22D@silverinsanity.com>
In-Reply-To
<1298903102.14697.127.camel@lenovo-w500>
On Feb 28, 2011, at 9:25 AM, Michael Meeks wrote:
> 	I'm really looking for an equivalent of 'cp -lR foo baa' that:
> 
> 	* uses hard links to save space
> 	* produces precisely-a-duplicate repository
I mostly handle this sort of thing by branch switching in the same checkout, which I assume you're trying not to do because of recompilation time.  Your way, eventually the repositories in question would start to diverge and you'd have to keep them in sync manually, which sounds far less than ideal.  Eventual repacks would break the hard links and you'd even lose the space savings.
What you might be interested in is the git-new-workdir script in git.git/contrib/workdir.  It uses symbolic links to create a new working directory backed by the exact same object store and config as the original.
This is not a situation git is well designed for, honestly.  The more "git-like" work flow would be to maintain a single central, probably bare, repository on your machine that pulls from everything that all your local repositories need.  Then set up the other repositories to get all the references from the central repo.  Then there's only one that needs to be updated from the remotes.  If you use the --reference option to git-clone, you're not even duplicating the object store and each clone only has the objects it needs.
~~ Brian
Previous: Andres FreundNext: Michael J Gruber
Message 8 of 12 in “libreoffice merge(tool?) issue #3 ...”
  1. Michael MeeksFeb 22, 2011
  2. Brian GernhardtFeb 22, 2011
  3. Michael MeeksFeb 24, 2011
  4. Michael J GruberFeb 25, 2011
  5. Andres FreundFeb 25, 2011
  6. copying git repositories ...Michael Meeks, Feb 28, 2011
  7. Andres FreundFeb 28, 2011
  8. Brian GernhardtFeb 28, 2011
  9. Michael J GruberFeb 22, 2011
  10. Michael MeeksFeb 22, 2011
  11. Michael J GruberFeb 23, 2011
  12. Michael J GruberFeb 23, 2011

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.