Reset
ELI5 — The Vibe Check
Reset is like pressing undo on your commits. It can be gentle (keep your changes but uncommit them) or nuclear (delete everything and go back to a previous state). Use with caution — the nuclear option can't be undone easily!
Real Talk
Git reset moves the HEAD and current branch pointer to a specified commit. Soft reset keeps changes staged, mixed (default) keeps changes unstaged, and hard reset discards all changes. Hard reset is destructive and should be used carefully.
Show Me The Code
git reset --soft HEAD~1 # undo commit, keep staged
git reset HEAD~1 # undo commit, keep unstaged
git reset --hard HEAD~1 # undo commit, DELETE changes
When You'll Hear This
"Reset to the last commit." / "Be careful with hard reset — you'll lose your changes."
Related Terms
Commit
A commit is like pressing the save button in a video game.
HEAD
HEAD is like a bookmark that says 'you are here' in your Git history. It points to the commit you're currently looking at.
Revert
Revert is the safe undo button. Instead of erasing history (like reset), it creates a NEW commit that undoes the changes from an old commit.
Stash
Stash is like putting your messy work in a drawer temporarily.