Learn git reset, revert, and amend to undo changes safely
Understand soft, mixed, and hard reset, plus revert and amend — with exercises that show exactly how each command changes the commit graph.
Undo workflow
Start undo challenge
01
Amend the last commit
Fix the most recent commit message or snapshot without adding a new node.
02
Reset to an earlier commit
Use git reset --hard HEAD~1 when you want to drop the latest commit from the branch.
03
Revert safely
Create a new commit that undoes a previous change — ideal for shared history.
Hard reset to move the branch pointer back
Revert with a new safe commit
Git reset guide
Undo workflow
Amend the last commit
Fix the most recent commit message or snapshot without adding a new node.
Reset to an earlier commit
Use git reset --hard HEAD~1 when you want to drop the latest commit from the branch.
Revert safely
Create a new commit that undoes a previous change — ideal for shared history.
Git reset FAQ
- What is the difference between reset and revert?
- Reset moves your branch pointer backward; revert adds a new commit that undoes a past change — safer on shared branches.
- What does git reset --hard do?
- It moves the branch to an earlier commit and discards staged and working changes to match that commit.
- When should I use git commit --amend?
- Use amend to fix the latest commit before you push — for typos in the message or forgotten staged files.
- Can I practice reset without breaking a real repo?
- Yes. The Game4Git playground lets you experiment and see the graph update instantly.
Related guides
Combine undo skills with remote workflows and merge practice.
Learn git fetch, pull, and push with a visual remote workflow
Practice syncing with origin/master: fetch remote refs, push your commits, and pull when the remote moves ahead — all on an interactive commit graph.
Learn Git branches with hands-on branch practice
Learn Git branching with guided branch practice. Create branches, switch context, and merge with confidence while the visual graph shows every pointer move.
Learn Git merge conflicts with an interactive conflict workflow
Understand Git conflict markers, compare both sides of a merge, and practice resolving merge conflicts without breaking your history.
GDB Learning
Powerful debugging for C/C++ programs with step-by-step execution, breakpoints and memory inspection.