How to remove an accidental commit of a large file

I frequently commit large files into my development branch like log files and binary files by accident.

I always end up needing to do a google search for how to resolve and subsequently end up forgetting what it is I have done.

Here is a simple way to remove a large from a git repo.

git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch path/to/large_file.log' \
  --prune-empty --tag-name-filter cat -- --all
Design a site like this with WordPress.com
Get started