How to undo your last Git commit

Did you accidentally commit too fast? Here's how you undo it.

Sometimes we make a commit and then realize we forgot a file, or accidentally committed too many files. But you haven't push the changes to GitHub or GitLab yet.

Here's how you can undo your last commit.

bash
git reset HEAD~

That's all it is! Happy coding!