Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Remove big (.zip) files from git history

Remove big (.zip) files from git history - the best web developer in Bangladesh

I accidentally commit a few .zip files and then revert and delete the .zip files. But when I am trying to push the codes to GitHub then getting a large file error. Because those files’ history is still in the git commit history. After searching few days, I get and figure-out this solution.

Note: there may be other solutions that will efficient for you. But for me, this has worked like a hot knife on the butter because my repository was not too big. So, if you have a huge repository then you can try BFG cli.

  • Please take a backup of your repository or files
  • Now run the below command

git filter-branch –prune-empty –index-filter ‘git rm -rf –cached –ignore-unmatch BIG_FILE‘ –tag-name-filter cat — –all

Replace the BIG_FILE with your file name, in my case I changed it to *.zip (as I forgot the file name and wanted to remove all .zip file history)

To know more, you can check this article: Finding and Purging Big Files From Git History

If this article helps you then let me know in the comment. And you can share this too.

Happy committing! Be healthy and happy!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Wordpress Social Share Plugin powered by Ultimatelysocial