Introduction
Mistakes happen when working with code. Knowing how to undo changes helps you fix errors quickly without losing work or causing bigger problems.
When you accidentally add wrong files to your commit and want to remove them before pushing.
When you realize your last commit message has a typo and want to correct it.
When you want to discard local changes that you no longer need.
When you want to go back to a previous version of your project safely.
When you want to undo a merge that caused conflicts or issues.