Sirac
Sirac

Reputation: 693

Compress git commits

I use git for something it is not intented to, binary files. The project-files are around 80Mb big and the .git-directory, containing 4 commits, adds another 160Mb. There will be many more commits and therefore much more disk space will be needed. Yet, I have another computer with enough disk space and I want to somehow move the repository there.

My first thought was to move the complete repository to the second computer and every time a commit has to be made I move the files between the computers and then make the commit. Given that I won't be making commits all the time this solution is possible, yet tiresome.
My second thought was to create a remote repository, but that does not solve the space-problem.

My newest and very "creative" idea is the following: Create a remote-respository on the second computer and "compress" the commits on the first. Given this commit-history:

A <----- B <----- C <----- D

Where arrows denote the parent-commit. It should be possible to merge the changes of the first three commits into one. No matter how, by creating a temporary repository and copying the important files into it, somehow it can be done. Then the repository will look like this:

A' <----- D

For this we had to forcefully set the parent of D from A to A'. But because the parent-commit of D changed I don't think I would be able to push D to the remote repository any more.

To sum it all up: I have a git-repository with big binary files that takes up much space. I want to use the disk-space of another computer, but I have to keep the binary files where they are. To keep it easy, there will be no branching involved.

Upvotes: 0

Views: 241

Answers (1)

Roland Smith
Roland Smith

Reputation: 43495

Synchronizing the repo from a machine that has more resources doesn't have to be tiresome. You could automate it.

For example:

  • Use rsync in a post-commit hook to push the changes in the working copy only to the other machine.
  • Share the repo (read-only) with the less powerful machine using NFS or a windows network share.

Upvotes: 1

Related Questions