Git reset guide

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.

1 Amend the last commit message or content
2 Hard reset to move the branch pointer back
3 Revert with a new safe commit
Learn git reset, revert, and amend to undo changes safely

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.

01

Amend the last commit message or content

02

Hard reset to move the branch pointer back

03

Revert with a new safe commit

Git reset guide

Undo workflow

01
1

Amend the last commit

Fix the most recent commit message or snapshot without adding a new node.

02
2

Reset to an earlier commit

Use git reset --hard HEAD~1 when you want to drop the latest commit from the branch.

03
3

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.