0 votes
1 view
in Devops and Agile by (29.9k points)

Occasionally I dropped a DVD-rip into a website project, then carelessly git commit -a -m ..., and, zap, the repo was bloated by 2.2 gigs. Next time I made some edits, deleted the video file, and committed everything, but the compressed file is still there in the repository, in history.

I know I can start branches from those commits and rebase one branch onto another. But what should I do to merge together the 2 commits so that the big file didn't show in the history and were cleaned in garbage collection procedure?

1 Answer

0 votes
by (51.2k points)

Reference: https://git-scm.com/docs/git-filter-branch#_notes

You can Use the BFG Repo-Cleaner, a simpler, faster alternative to git-filter-branch specifically designed for removing unwanted files from Git history.

java -jar bfg.jar --strip-blobs-bigger-than 100M my-repo.git

The above command will help you to delete the files over 100 MB will be deleted from your git repository.

To clean that dead data use:

git gc --prune=now --aggressive

This will be faster than the git-remote filter. This will help you to delete a large file from commit history in the git repository.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !