TL;DR: There is a phrase in our git repository that must be removed from history, not just the heads of branches. What other ways are there besides removing it from the head of develop and making a new repository? We want to maintain as much history as possible.
Background
For icky legal reasons, my team and I have to remove all instances of a word from our code base (let's call it Voldemort just for fun and relevance). The annoying thing is that we don't just have to remove Voldemort from the tips of the branches, we have to remove it from each commit in our repositories (the lawsuit is something along the lines of "no developer should be reasonably able to revert to a state where Voldemort was in the code").
We're not using Voldemort anymore, but there are a few places in the code where it's still mentioned like comments. (Yes, as part of a law suit we have to remove infringing comments from our code.)
The original plan was to purge the word that must not be mentioned and then make a new repository and push the current state as the initial commit. We don't want to lose all our history1 though! So we want to know if there's a way to avoid that.
So, the question is how do we remove Voldemort, the word which must not be mentioned, from the history while maintaining as much of the history1 as possible? Also, what can we do to make sure it's not in any commit? We want to know how to check our work to make sure it's gone.
1: By history I don't mean the specific commits, I just mean being able to look at the history of a file and know who did what, it's okay to me if the history is gone as in "rewriting history" in the git sense, I'm actually guessing it's the only approach.
Information on the state of the repo
- Currently develop branch is Voldemort-free, but we have "meaningful" commits before and after the purging commits
- Probably only the initial commit has anything adding lines with Voldemort (because we migrated from SVN to git and Voldemort was added ages ago)
- Probably the only commits modifying any files with Voldemort are the ones that removed it (like I said, it's pretty old stuff)
Guesses for an approach
Seems like we'd want to do something like git log --patch | grep 'Voldemort'
to find commits that add Voldemort then do an interactive rebase of everything editing the commits where Voldemort was added to add some other thing or nothing at all.