git reset --soft HEAD~1
git status
..remove files that was to be commited..
git commit -m "previous message" git reset --soft HEAD~1
git status
..remove files that was to be commited..
git commit -m "previous message"git undo
git undo file
And to add to the fun, there's multiple other answers in this thread on how to accomplish the same task.
git reset --soft HEAD^
# make changes so index only contains what you want
git commit -a -C ORIG_HEAD
of if you prefer: git config --global alias.undo reset --soft HEAD^
git config --global alias.redo commit -a -C ORIG_HEAD
then: git undo
# make changes so index only contains what you want
git redo
You could use -c (--reedit-message=) instead of -C (--reuse-message=) for further flexibility.ORIG_HEAD is set to point to the most recent HEAD when using reset. See "man git-reset" > EXAMPLES > "Undo a commit and redo".