GIT-OBLITERATE(1)

πŸ’… GIT-OBLITERATE(1) πŸ’…

okay bestie, welcome to git-obliterate β€” it's from the Git Extras collection, and it is genuinely one of the most unhinged little commands in the whole box. buckle up. πŸŽ€


✨ NAME ✨

git-obliterate β€” rewrite past commits to remove some files 🫢


🌸 SYNOPSIS 🌸

git obliterate <files...> [-- <rev-list options...>]

πŸ‘‘ DESCRIPTION πŸ‘‘

so like. you know how some file just needs to not exist anymore? not just "delete it going forward" β€” like, gone from the past too, from commits, from tags, from the whole timeline. that's what this does. it completely removes some files from the repository, including past commits and tags. no cap. πŸ¦‹

WARNING! This command will rewrite the history similar to git rebase (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 avoid using it on commits that you shared. And it will mess up stash, so don't have stash when you run git obliterate.

πŸ’€ let me say that again in group-chat form: every single object in your rewritten history gets a different object name, and it will never converge with the original branch. so if you already pushed those commits to other people? bestie. do not. πŸ™ˆ

and the stash thing β€” fr fr, do not have a stash when you run this. it will mess it up. clear your stash first, queen. ✨


πŸ’– OPTIONS πŸ’–

You can pass rev-list options to indicate the range of commits affected. Those options need to be separated with -- before them. Run git help rev-list to see the acceptable options.

  • <files...> β€” the files you want obliterated from history. raw. unfiltered. gone.
  • -- <rev-list options...> β€” everything after the -- is the range of commits you're affecting. remember the --, it's the lil barrier. πŸ’…

🌈 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

like look at those. three lines and a whole file stops existing across time. main character energy honestly. πŸ”₯


πŸŽ€ AUTHOR πŸŽ€

Written by <brianloveswords@gmail.com> β€” ty for the obliteration tech, king 🫢


πŸ› REPORTING BUG πŸ›

<https://github.com/tj/git-extras/issues> β€” go yell there if something's broken, not at me πŸ“


πŸ‘€ SEE ALSO πŸ‘€

<https://github.com/tj/git-extras>


okay that's the whole page, you ate it, periodt. πŸ’œ this was Git Extras, version May 2026, and yeah the little footer says GIT-OBLITERATE(1) too β€” we been knew. now go forth and rewrite history responsibly (or don't, i'm not your mom). 🧚✨

πŸ“¦ where this page comes from