1

I am aware of sparseCheckout, but this still is causing issues for me.

I have a repo that is about 200GB in size with over 60 thousand commits. This means that cloning it takes a huge amount of time due to the huge file size and lengthy history.

Following the steps to start an empty repo and then add the remote origin, adding the origin took 20 minutes and has used over 10GB of disk space.

There must be a better way to do this that doesn't take so long and won't use up my disk space?

All I want to do is squash some commits in a branch so that one of our bots will approve the commits (PR) before I can merge (this is why I can't just squash and merge through GH).

Any ideas please?

Note: I don't believe a shallow copy is of any help here as the repo is still 10GB at HEAD which I want to avoid cloning completely.

Biffen
  • 6,249
  • 6
  • 28
  • 36
Matt Cowley
  • 2,164
  • 2
  • 18
  • 29
  • You can make a *shallow* clone, which is one that has the history cut off at a graft-point. The graft point is your choice via the `--depth` option. You can also make a *single-branch* clone, which is the default when using `--depth`. Such clones have some restrictions, so be careful when choosing this route. – torek Apr 10 '19 at 21:19
  • Possible duplicate of [Using git to get just the latest revision](https://stackoverflow.com/questions/1209999/using-git-to-get-just-the-latest-revision) – phd Apr 11 '19 at 00:49
  • https://stackoverflow.com/search?q=%5Bgit%5D+shallow+clone – phd Apr 11 '19 at 00:49
  • @MattCowley I've deleted my answer once is not helpful. What you want is this: https://stackoverflow.com/a/13738951/575643 – Idemax Apr 11 '19 at 12:38
  • @MarceloFilho My issue with a sparse clone is that `git remote add -f origin ` still takes 20 minutes and consumes about 10GB? – Matt Cowley Apr 11 '19 at 14:38
  • Because of underlying storage compression, repos don't really have a size "at" any one commit. *Checkouts* have a size at each commit. If the full checkout of the commit you're interested in is 200 GB, then you're stuck: Git can't help you at all, because no matter how you trim your clone, you need that much data to get the commit, and you need the whole commit even if you're just going to `git checkout` a subset of it. You'll have to just not use Git. – torek Apr 11 '19 at 16:14

0 Answers0