Module 5 · Lesson 2 of 519/34 in the course~18 min
Module lessons (2/5)
Moving pointers cleanly (git reset --soft / --mixed / --hard)
Lesson preview5 hands-on exercises readyGit & Modern Collaboration · Module 5 — Undoing Mistakes & Recovery
See how soft, mixed and hard resets affect HEAD, Index and Working Tree differently.
What you'll learn in this lesson
- Predict how
git resetalters Git's Three Trees depending on--soft,--mixed(default), or--hard. - Use
git reset --soft HEAD~Ncleanly to combine or squash recent unpushed commits before pushing. - Recognize when
--harddestroys uncommitted edits permanently vs merely orphaning committed objects.
Overview
Unlike git restore (which copies files into the Index or Working Tree without touching HEAD), git reset moves the current branch pointer (HEAD) itself backward or sideways — then optionally rewrites the Index and Working Tree to match!
Memorize the progressive cascade across Git's Three Trees:
Sections covered in this lesson
- 1Moving Branch Pointers Across the Three Trees
- 2Test All Three Reset Modes Interactively
Pro Lesson · Module 5 — Undoing Mistakes & Recovery
Unlock "Moving pointers cleanly (git reset --soft / --mixed / --hard)" and the full Git & Modern Collaboration curriculum
See how soft, mixed and hard resets affect HEAD, Index and Working Tree differently.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Git & Modern Collaboration plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.