Browse Git Topics ▼

git reset (Soft, Mixed, Hard)

📂 Undoing Changes 📘 Lesson 17 of 22

Rewind repository history across commits using soft, mixed, and hard resets.

git reset (Soft, Mixed, Hard) is an essential topic in GIT.

Overview

Mastering git reset (soft, mixed, hard) provides the core mental model and practical skills needed for real-world software engineering workflows.

# Undo last commit but keep changes staged
git reset --soft HEAD~1

# Undo last commit and keep changes unstaged in working directory
git reset --mixed HEAD~1

# DANGEROUS: Erase commit and discard all modifications
git reset --hard HEAD~1

Key Concepts

  • Understand the fundamental syntax, commands, and architecture.
  • Learn standard conventions, safety guardrails, and common pitfalls.
  • Apply practical idioms directly in production environments.

[!TIP] Practice these core patterns thoroughly. Next, proceed to git-revert.

Test your understanding of git reset (Soft, Mixed, Hard)

Quick interactive practice questions with instant feedback.

Take Quiz →