X |
git reset --hard HEAD && git clean -fd |
Working tree + staging + untracked |
⭐⭐⭐⭐⭐ |
Completely wipe all local changes |
u |
git checkout -- . |
Working tree (unstaged only) |
⭐⭐ |
Discard unstaged changes |
c |
git clean -fd |
Untracked files/dirs only |
⭐⭐⭐ |
Clean build artifacts, logs, etc. |
S |
git reset HEAD |
Staging area only |
⭐ |
Unstage files (keep working changes) |
s |
git reset --soft HEAD |
Commit history only |
⭐⭐ |
Amend last commit (keep staged changes) |
m |
git reset --mixed HEAD (or git reset) |
Commit history + staging |
⭐⭐ |
Redo commit from scratch (keep work) |
h |
git reset --hard HEAD |
Working tree + staging + commit |
⭐⭐⭐⭐⭐ |
Force reset to a clean state |