How to permanently delete a file stored in GIT? [duplicate]

I always find Guides: Completely remove a file from all revisions feed helpful.

To remove the file called Rakefile:

git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch Rakefile' \
  --prune-empty --tag-name-filter cat -- --all

This command will run the entire history of every branch and tag, changing any commit
that involved the file Rakefile, and any commits afterwards. Commits
that are empty afterwards (because they only changed the Rakefile) are
removed entirely.

Leave a Comment