git log commit 101: bad commit # Latest commit. This would be called 'HEAD'. commit 100: good commit # Second to last commit. This is the one we want.
git reset --soft HEAD^ # Use --soft if you want to keep your changes git reset --hard HEAD^ # Use --hard if you don't care about keeping the changes you made
git revert HEAD
git commit -m 'restoring the file I removed by accident' git log commit 102: restoring the file I removed by accident commit 101: removing a file we don't need commit 100: adding a file that we need