I accidentally committed some sensitive information to a public git repo (yikes!). Is there any way I can permanently remove all history between a certain date range? Should I just delete the entire repo and start fresh?
The standard way of doing this is with
The command you would run might look something like this:
Piece by piece:
When finished, you'll have a brand new commit checked out with identical history except for the lack of
For example, if your history looked like this, and commits B-C were tainted:
When you're finished, your history will now look like this:
Notice that D and E have been re-written to D' and E'. They might point to the same trees, but since history changed, they will have new commit IDs and are considered new commits as far as Git is concerned.
More information about using