git filter-branch is a powerful command which you can use it to delete a huge file from the commits history. The file will stay for a while and Git will remove it in the next garbage collection. Below is the full process from deleteing files from commit history. For safety, below process runs the commandcommands on a new branch first. If the result is what you needed, then reset it back to the branch you actually want to change.
# Do it in a new testing branch $ git checkout -b test # Remove file-name from every commit on the new branch # --index-filter, rewrite index without checking out # --cached, remove it from index but not include working tree # --ignore-unmatch, ignore if files to be removed are absent in a commit # HEAD, execute the specified command for each commit reached from HEAD by parent link $ git filter-branch --index-filter 'git rm --cached --ignore-unmatch file-name' HEAD # The output is OK, reset it to the prior branch master $ git checkout master $ git reset --soft test # Remove test branch $ git branch -d test # Push it with force $ git push --force origin master