git-obliterate - rewrite past commits to remove some files
Contents
Description
Completely remove some files from the repository, including past commits and tags. WARNING! This command
will rewrite the history similar to gitrebase(though it affects more). The rewritten history will have
different object names for all the objects and will not converge with the original branch. So avoidusingitoncommitsthatyoushared. And it will mess up stash, so don'thavestashwhenyourungitobliterate.
Examples
Remove .secret from the repository:
$ git obliterate .secret
Remove .secret from commits between origin and feature:
$ git obliterate .secret -- feature ^origin
Remove .secret from commit abcdefg to commit 1234567
$ git obliterate .secret -- abcdefg..1234567
Name
git-obliterate - rewrite past commits to remove some files
Options
You can pass rev-list options to indicate the range of commits affected. Those options need to be
separated with '--' before them. Run githelprev-list to see the acceptable options.
Reporting Bug
<https://github.com/tj/git-extras/issues>
See Also
<https://github.com/tj/git-extras>
October 2024 GIT-OBLITERATE(1)
Synopsis
git obliterate <files...> [-- <rev-list options...>]
