Last Updated: February 25, 2016
·
514
· samd

Remove file from last commit

I often accidentally commit a file I don't mean to (primarily due to the muscle memory of typing git add . ). To remove a file from the last commit:

git reset HEAD^1 path/to/file/to/remove
git commit --amend

Simples!

sx