Remove file from git history

Remove file from git history

Switching from Bitbucket to Github had one hickup I didn't expect. On Github the maximal file size is 100MB. On Bitbucket it's higher and I had a video with over 345MB in my repository. But only at the beginning. As it's still part of the repository history it wasn't possible to push the repository to Github.

I was able to push it after I removed the file from the complete history. This might also be helpful if you ever pushed sensitive data on accident into the repository.

Use the following command to remove a file from your history.

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch path/to/file' --prune-empty --tag-name-filter cat -- --all