0

I am dealing with a repo that for reasons I can't do anything about have zip files that get to few mb and often change with each commit. I understand that means git is storing a complete copy of each zip for each commit, rather than deltas.

We are working with feature branches. If I squash commits in a feature branch before merging to master, will that reduce the space taken by all those zips?

Robert Mark Bram
  • 8,104
  • 8
  • 52
  • 73
  • 1
    Yes, it squashing in this case should reduce the space taken, because by definition it will be reducing the number of commits of each ZIP file. By the way, Git doesn't really store the diff, it stores the entire file, compressed. ZIP files can't really be compressed any further, hence your storage problem. – Tim Biegeleisen Jul 03 '20 at 02:17

1 Answers1

2

It will reduce the size because only the latest zip file makes it in to master. Just be sure to delete any remote branches you have created that contain multiple versions of the zip file scattered throughout multiple commits.

Locally, delete the source branch and run git gc to remove commit objects that are no longer referenced by a branch, which should clean up unused copies of the zip files as well.

Greg Burghardt
  • 17,900
  • 9
  • 49
  • 92