Remove File From Git History

RustyRazorblade Consulting RustyRazorblade Consulting
1 min read

Useful stuff.

git filter-branch -f --index-filter 'git update-index --remove filename' HEAD
git push --force --verbose --dry-run
git push --force

Slight better version. Only rewrites history from the first commit the file existed.

git filter-branch -f --index-filter 'git update-index --remove filename' <introduction-revision-sha1>..HEAD
git push --force --verbose --dry-run
git push --force

Found on github.

Useful stuff.

git filter-branch -f --index-filter 'git update-index --remove filename' HEAD
git push --force --verbose --dry-run
git push --force

Slight better version. Only rewrites history from the first commit the file existed.

git filter-branch -f --index-filter 'git update-index --remove filename' <introduction-revision-sha1>..HEAD
git push --force --verbose --dry-run
git push --force

Found on github.

RustyRazorblade Consulting

RustyRazorblade Consulting

Apache Cassandra Consultant and Distributed Systems Expert

Related Posts

Need Expert Help with Apache Cassandra?

Get professional consulting for your distributed systems challenges. Performance optimization, architecture design, and troubleshooting.