gitgithubgit-rm

Git remove file from all commits


I made a "little" mistake and added a "little" (>100MB) file to my local repo.

Two commits later I'm trying to push to remote repo in github that have a limit of 100MB.

I can remove the file from my current commit with git rm --cached, but it still in previous commits.

How can I remove the file from all commits? I've tried this answer about git filter-branch but don't work for my.


Solution

  • You could change the last 3 commits by interactive rebase.

    git rebase -i HEAD~3
    

    And change the commit to "edit".

    See https://help.github.com/articles/about-git-rebase/