git : How to remove a big file wrongly committed

I added a large file to a git repository (102Mb), commited and push and got an error due to size limit limitations on github

remote: error: GH001: Large files detected. You may want to try Git Large File Storage -
remote: error: Trace: 7d51855d4f834a90c5a5a526e93d2668
remote: error: See for more information.
remote: error: File coverage/sensitivity/simulated.bed is 102.00 MB; this exceeds GitHub's file size limit of 100.00 MB

Here, you see the path of the file (coverage/sensitivity/simualted.bed).

So, the solution is actually quite simple (when you know it): you can use the filter-branch command as follows:

git filter-branch --tree-filter 'rm -rf path/to/your/file' HEAD
git push
Please follow and like us:
This entry was posted in Computer Science and tagged , . Bookmark the permalink.

40 Responses to git : How to remove a big file wrongly committed

  1. Drdrej says:

    thank you!

  2. Nikiya Simpson says:

    You don’t know how much I appreciate this! I’m glad I found you on google.

  3. Thanks a lot, another life saved. Just want to add that I hat to put the command ‘rm -rf path/to/your/file’ between double quotes “rm -rf path/to/your/file”

  4. Anonymous says:

    That did it, thanks so much!

  5. Filipe Fenrich says:

    Thank u very much!!

  6. milad khanmohammadi says:

    so many thanks, you fixed my problem.
    i really appreciate you

  7. Ravi says:

    Appreciate the solution…

  8. Samuel James says:

    Thanks for this!

  9. Tony Nguyen says:

    Thank you very much

  10. Borat says:

    as Borat would say “Woa woaaa weee waaaa. I like! High five!”

  11. Pingback: Git : How to remove a big file wrongly committed - Black Deer Dev

  12. Brad says:

    If it is a shared repo, you should consider the following before doing this:

    WARNING! The rewritten history will have different object names for all the objects and will not converge with the original branch. You will not be able to easily push and distribute the rewritten branch on top of the original branch. Please do not use this command if you do not know the full implications, and avoid using it anyway, if a simple single commit would suffice to fix your problem. (See the “RECOVERING FROM UPSTREAM REBASE” section in git-rebase[1] for further information about rewriting published history.)

  13. Vinicius says:

    OMG! You can’t imagine how long I took to come to your post.
    I deleted my files with git rm, I almost have a heart attack when I did it.
    Then I recovered the files with pycharm and tried so many things till getting to this post that solved all my problems!


  14. lil uzi vert says:

    this saved my life! no cap

  15. Anonymous says:


  16. Arif says:

    thank you!

  17. Anonymous says:


  18. MW says:

    Note that if your original commit and push with the large files was done with unresolved changes, you will not be able to use this git filter-branch solution directly. You will need to first add and commit all untracked or modified objects, or you will need to add those to .gitignore. Once done the steps above will work.

  19. Anonymous says:

    Highly appreciate

  20. Anonymous says:


  21. Anonymous says:

    Thank you!

  22. G P says:

    Thanks a lot. Much more appreciated. 5 stars solution.

  23. Anonymous says:

    thank you for sharing

  24. Ab says:

    thanks alot !
    solved my problem

  25. Anand says:

    This Works fine. 100% solution

  26. Meena says:

    that was a bang on solution, thanks a lot dear!!!

  27. samik says:

    Thank you for this valuable post

  28. Grateful Guy says:

    Thanks a lot. Saved my asss

  29. Anonymous says:

    Very helpful, uh

  30. AIK says:

    Thank you so much. I have some big test golden files that I forget that are too big. So I always have problems with committing them by mistake.
    Your solution saved me so much time

  31. Anonymous says:

    Thankyou very much!!!

  32. Naveen says:

    just worked like charm, thank you

  33. Anonymous says:

    Thanks a lot

  34. Imad Najmi says:

    Thanks Works!

  35. anonymous says:

    god bless you my friend, helped me with easy solution after half a day of surfing web

  36. Tmarks says:

    Thank you so much. Finally this fixed an issue i had tried countless other ways!

  37. Anonymous says:

    God bless you.

Leave a Reply

Your email address will not be published.