At some point in the past, sensitive info was uploaded to a git repo. We removed this in the following commit and changed the info, but we'd still like to remove the original info from the git history, while preserving the commits made since then if possible.
I have been experimenting with the BFG repo cleaner and have discovered that the help command lists a "-p --protect-blobs-from " option not mentioned on their site. At first glance this seems to do exactly what we want, but the actual behaviour seems a bit bizarre: the file is removed from all commits older than the specified blob, as expected, but it's also removed from all commits newer than the specified commit. i.e: on the specified commit the file shows as a new file, with all the lines it had at that point, however in the next commit the file shows as being deleted. This means that the file is deleted from HEAD
Is there a way, using BFG or another method, to delete all history of a file from a certain commit while preserving everything since?
Edit for clarity: we have already removed all cases of sensitive info from our repo manually: in some cases that involved deleting whole files, in others we just changed a few lines. But the original files (with now-outdated) passwords can still be seen in the commit history so we're looking to remove this history, preferably without losing the record of changes we've made since then (in some cases, the passwords were removed many months ago and there have been dozens of commits since). I know about the BFG -D option that will delete the entire history, but if possible we'd like to keep the commits that have been made since we removed the passwords
Thanks