How to Flatten the History of a Git Repository Safely