0

We are doing svn to git migration. We had around 5 big binary files ( each is around 700MB ) in SVN. So just deleted those files and migrated to GitHub. Now git source codes' size is less only. But git object pack is more than 8GB. I think because of these binary files revision. Shall I can remove these particular revision history ? Or anyway other way is there to clean up? We need remaining files' history.

Kalaiyarasan
  • 267
  • 3
  • 6
  • 13
  • Possible duplicate of [How to remove/delete a large file from commit history in Git repository?](https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository) – phd Mar 31 '18 at 17:11

1 Answers1

2

Run the following command replacing FILE-TO-BE-REMOVED with the path to the file you want to remove, not just its filename. These arguments will:

  • Force Git to process the entire history of every branch and tag
  • Remove the specified file, as well as any empty commits generated as a result
  • Overwrite your existing tags

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE-TO-BE-REMOVED' --prune-empty --tag-name-filter cat -- --all

Once you're happy with the state of your repository, force-push your local changes to overwrite your GitHub repository, as well as all the branches you've pushed up:

git push origin --force --all

sensorario
  • 20,262
  • 30
  • 97
  • 159