I use Cline in VSCode and I am not aware of it corrupting files.
But I also use git extensively and revert often.
Best pattern I found recently was to get it to document the feature as an issue in GH CLI, then create and build on a feature branch.
If it fails too badly, delete the branch and try again. If you need to reboot it, bootstrap the next session from the issue and the diff.