Git reset or git revert. They sound the same, but they’re intended for very different purposes.
Ask one question: Did you already push it?
- If the changes are still on your machine, use reset.
- If you already shared them with your team, use revert, which walks back the changes safely with a new commit instead of rewriting history everyone already has.
Rule of thumb: if you pushed it, revert. If it’s still local, reset.
Want the full breakdown (soft / mixed / hard reset, revert by hash, and the reflog safety net)? Watch the full video: Undo Anything in Git
Follow along for more git tips like this!