I need to delete commits made 1 year ago because they contain sensitive data that must be removed.
I have used BFG Repo-Cleaner, and I have been able to almost delete everything, but there are some very old commits that are not being removed.
I will try to write an example; The GIT history looks like this
- C -> secret files do not exist
- B -> secret files are removed
- A -> secret files were added
(A being the oldest and C the newest commit)
And this is what I would need (B does not exist anymore, but later commits are not affected):
- C -> secret files do not exist
- A -> secret files were added
I'm working in a big team so, unless there is no other option, I would like to avoid using git push -f
.
What is the best way to achieve this?
Thank very much.
(edit)
The reason for this is that we have a regular scan on our repo that detected commit A as a vulnerability.
We made commit B, were we deleted all credential and secret files, and the problem is that the scan also detects the commit B as a 'security issue'.
We are asked to remove commit B to pass the scan.