RevertCreates a NEW commit that undoes the changes from a previous commit. Safe for shared history — it doesn't rewrite the past.
Reset (--soft)Moves the branch pointer backward but keeps changes in the staging area. The working directory stays untouched.
Reset (--mixed)Moves the branch pointer and unstages changes. This is the default mode. Changes remain in your working directory.
Reset (--hard)Moves the branch pointer, unstages changes, AND resets the working directory. Destructive — uncommitted changes are lost.
View the commit history
Notice the latest commit "Oops bad commit" is the last entry. We want to undo it.
● View the commit history
○ Revert the bad commit
○ Reset to remove the last 2 commits (soft)
○ Reset mixed (default)
○ Reset hard — discard everything
🧩 The Pre-PR CleanupUnsolved
📖 Story
Your branch has five commits but it's a mess:
- "WIP" (empty, no files changed)
- "add login" (vague)
- "fix typo" (should be squashed into the one above)
- "add logout" (fine)
- "actually add logout" (duplicate, should be squashed)
Your team requires clean commits before review. Use interactive rebase to produce exactly two commits: "Add login feature" and "Add logout feature".
Goal
Solve the problem by using the correct Git commands.
Terminal
🧩 Problem: The Pre-PR Cleanup
Squash fixup commits, reword vague messages, and drop an empty commit before opening your PR.
Use the terminal to solve the problem. Results are checked automatically.