Lesson 20 / 26
git revert
Undo a commit safely by adding a new, opposite commit.
Undo without rewriting history
revert creates a new commit that undoes an earlier one — the original commit still exists in history.
git revert a1b2c3d
Output:
[main 4d5e6f7] Revert "Add experimental cache"
revert vs reset
Use revert on commits already pushed and shared — it's safe for everyone. Use reset only on local, unpushed commits.