Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are limitations of shallow clone

Tags:

git

In our organization where we are trying to introduce Git, we have now a problem related to Git behavior with respect to binary files.
Our projects will have a good mix of binary and text type files and a typical size could be 1 GB. Our fear is that after few years a full clone would become too big and cause performance and disk space issues.
One of the environment that would migrate to Git have their SW currently on a system called TCM. The total size of repositories with versions of 7-10 years is 2 TB.
Another environment on ClearCase has around 7-8 years data of around 1 TB.
With Git not storing in deltas which will particularly affect binary files, a situation post 5+ years is causing concern to our users.
Shallow clone feature would have been ideal. But the docu says this "A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.". A cursory check on shallow clones would show that it works fine, but definitely there are known use-cases where it wont work, hence document
Is there a known list of use-cases where this wont work?

like image 322
maxmelbin Avatar asked Oct 30 '12 11:10

maxmelbin


2 Answers

I would urge you to store binary files in a dedicated repository, easy to scale and easy to clean up: an artifact repo like Nexus.
You have other alternatives in "How to handle a large git repository?".

Trying to keep everything in Git, using it in some unnatural way, will always result in more trouble that is is worth: it is a source control tool. You might as well use it for what it is good for.

That being said, a shallow clone doesn't support push (or, at least, it is dangerous: see "Why can't I push from a shallow clone?").
For read-only purpose, a simple git archive would be enough, as mentioned in "not understanding git shallow clone".

Updates 2015:

  • actually, you now can use a shallow clone for push/pull, see "Is git clone --depth 1 (shallow clone) more useful than it makes out?"
  • you can (with Git 2.5+) even fetch a single commit. See "Pull a specific commit from a remote git repository".
like image 177
VonC Avatar answered Oct 22 '22 16:10

VonC


Git Annex solves the "big-binary-files in/near git" problem quite beautifully, as well.

like image 23
Andreas Klöckner Avatar answered Oct 22 '22 16:10

Andreas Klöckner