Home | Edit | New

Guides: Completely remove a file from all revisions feed

Don’t you hate when you can’t remove that file full of cleartext passwords from your github account? Even if you git rm it, it still is accessible in previous versions of the tree. So, you need to rewrite the entire tree. Fortunately, this is really easy with git.

How?

git filter-branch --index-filter 'git update-index --remove filename' HEAD

filename is what you want to remove. Then,


git commit -a
git push

Now, when you browse past revisions, the file will be gone!

References

git-filter-branch documentation

Last edited by hank, 2 months ago
Versions: