Based on https://stackoverflow.com/questions/1186535/how-do-i-modify-a-specific-commit
First of all create a backup of the target repository.
Assume that you have commit with id bbc643cd. You would like to change it and overwrite subsequent git history.
Execute the following command to start the process (~ at the end is important):