[Git] Remove files from last commit

You made a commit which has files that should not have been there. Worry not!

git reset --soft HEAD~1   // to soft reset (preserve changes)
git reset HEAD  /files/you/wish/to/unstage


You can now commit the staged files and checkout the unstaged files

git commit 
git checkout /files/you/wish/to/checkout


That's it!

No comments: