The only way seems to be to copy the edits in some kind of GUI text editor, then wipe the whole local clone, then re-clone the repository, then re-applying the edits. However,
This can cause data loss. It's very hard to do this when only an accidental git commit was run. Is there a better way?