3

I have a 4 years old git repository that starts to become really huge: ~30GO, 60.000 files. One or two commit are done each day. I would like to squash every commits older than 1 year into the first commit. But because of technical issues, I can't just recreate the repo, I have to work with it. The git version available is 1.7.2.5 (not possible to update). The disk space is limited to 100go (so only 70go are still available) and the device memory is 4go (19mo of swap, yes MO...), not possible to move the repo on another computer either.

I tried the selected solution on this page Squash the first two commits in Git?, the February 2009 version. It works until the 'git rebase --onto'. The git-rebase causes a OutOfMemory error, I am not sure of the cause, I think it's maybe because it tries to play every commits in a single shot. I am thinking to use git-cherry-pick and playing each commit one at a time, then move master at the top of it.

Is it a good idea? or anyone has a better idea ? thks! :)

djoproject
  • 136
  • 8
  • Just increase the memory available to the virtual machine, that might fix the problem with out of memory. – Lasse V. Karlsen Nov 28 '17 at 17:01
  • The physicals settings of the VM are frozen, it's a really old proprietary virtual system. The only thing I could increase is the disk storage by adding an extra disk. – djoproject Nov 28 '17 at 22:40
  • `git replace` with `git filter-repo` should solve this and should be much more efficient than git-rebase(1). – Guildenstern Apr 29 '23 at 12:43

1 Answers1

-1

It's unlikely that the number of commits is causing the issue, git is very efficient at compressing text files.

The best way to reduce the size of a git repository is to use a tool such as BFG repo cleaner to remove large binary files from your history.

Compiled dependencies such as Nuget packages and Jars should be primarily stored in an artefact repository (not git), the application build process will fetch dependencies at build time.

You can also use Git LFS to store your binary files in a more transparent way.

Edmund Dipple
  • 2,244
  • 17
  • 12
  • The fact is, there are only text files in the repository, no binary at all. But I am also thinking about BFG or/and git-filter-branch to remove old and useless files through the whole history. – djoproject Nov 28 '17 at 22:43