git reset vs git revert vs git restore: Differences, --soft vs --mixed vs --hard and Which One to Use (Tested Examples)
git restore undoes changes to files, git reset moves your branch back and can rewrite history, and git revert adds a new commit that undoes an old one. Here is what each command really changes, with tested output from Git 2.47 and a simple rule for choosing.