1

I have a repo that contains fairly heavy binary files that are updated fairly often (yes, I know, this it's not what git was meant for).

While I want to keep the versioning for all of them on the server (Github in my case), I'd like to have downloaded only the last commit.

Currently, while the files themselves are only 1.5GB, the .git folder it's more than 10GB.

What I'd like to have it's something like a persistent shallow copy.

I'd like a git clone --depth=1 but instead of cloning it would "truncate" the local history down to the last commit.

Reading the git log after a fresh shallow clone I can see that last and only commit is "grafted". What does this mean? How would I "recreate" this situation?

Billy
  • 55
  • 6

2 Answers2

0

I would take a look at git for large files: https://git-lfs.com/. There have been previus questions about minimizing the size of a git lfs repo: How to shrink a git LFS repo and Will Git LFS reduce the size of your repo?

  • I'm aware of LFS, but it gets rather expensive rather quickly and I was trying to avoid it. I know it would be the most correct way to do it though. Thank you for the useful links! – Billy May 04 '23 at 13:27
0

It's worth considering git partial clones, in addition to git LFS as suggested by Casper Knudsen. See What is the git clone --filter option's syntax?, also the official docs at https://git-scm.com/docs/partial-clone. This would potentially allow you to have the full history but only download the blobs required on demand.

I think the syntax is something like git clone --filter=blob:none <url> or git clone --filter=blob:limit=<size> <url> to specify a size limit, but there may be other ways of using the feature of partial clones to achieve your goals.

Andrew McClement
  • 1,171
  • 5
  • 14