Hacker News new | ask | show | jobs
by nothrabannosir 2955 days ago
You could literally link the two object directories?

I just tried this and it seems to work:

  git clone git://github.com/git/git
  mkdir git2
  cd git2
  git init
  cd .git/
  rm -rf objects
  ln -s ../../git/.git
  cd ../
  git remote add origin git://github.com/git/git
  git fetch # returned without downloading anything
  git checkout master
  ls # etc.
If you seriously want to use this, you'll probably want to hard link the contents, instead. But iirc git clone from local disk already does that, for you?

In short: clone your local copy and taking it from there?

1 comments

You can also use alternates:

  echo ../../../git/.git/objects >> git2/.git/objects/info/alternates
or use the original as a reference:

  git clone --reference git git://github.com/git/git git2
This sets up the alternates for you.