#TIL 34 - Remove some files from last commit | ProductsWay
TILgit

#TIL 34 - Remove some files from last commit

Dec 5, 2022 · Dung Huynh

What

Undo your last commit while keeping all changes in the staging area.

Why

git reset --soft HEAD~1 moves the branch pointer back one commit without touching the index or working tree. You can unstage unwanted files with git reset <files> and recommit with a clean set — no re-editing needed.

How

git reset --soft HEAD~1

Files return to staging area. Remove unwanted files with git reset <files>, then re-commit.