How to undo your last commit in Git?

preview_player
Показать описание
A quick demo on how to undo your latest commit and then commit your new changes. Of course, as with everything, there are multiple possible solutions, this is just one way to do it.

Commands used in the video:

* To check the status run:
git status
* To check the git log run:
git log
* To check the difference in your files run:
git diff
* To revert the latest commit but keep your file changes run:
git reset HEAD~1
* To revert the latest commit and get rid of your changes run:
git reset --hard HEAD~1

I use DigitalOcean for all of my demos, you can use the link below to get a free $100 credit and spin up your own Linux servers!

Рекомендации по теме