u123
u123

Reputation: 16331

Dumping binaries in Git and reverting?

Assume that I add a 1 GB movie in a git repository commit and push. Next I revert the commit that I just pushed and push that. Now latest head no longer contains the 1 GB file.

Even though I just reverted the commit is it correct that the 1 GB file is now permanently part of the git history? Meaning that even though I am working on the latest head without the 1 GB file the repo is still 1 GB larger and will remain that forever?

Upvotes: 4

Views: 139

Answers (1)

VonC
VonC

Reputation: 1326982

Even though I just reverted the commit is it correct that the 1 GB file is now permanently part of the git history?

Yes, the repo will remain big: a version control system is made to retain history.

You would need to filter its history and clean it (with git filter-branch or BFG) in order to reduce its size (and that would change its history)

Plus, as mentioned in "How to update/shrink the size of my github repo after running BFG Repo Cleaner", you would need after the filter:

git reflog expire --expire=now --all
git gc --prune=now --aggressive

Upvotes: 3

Related Questions