DEV Community

Matthew LaFalce
Matthew LaFalce

Posted on

3 3

How To: Undo the Last Commit From Your Remote Git Repository

To undo the last commit from a remote git repository, you can use the git reset command.

First you can use the following command to undo the last commit locally.

git reset HEAD^
Enter fullscreen mode Exit fullscreen mode

Then you are able to use the following command to force push the local commit which was reverted to the remote git repository.

git push origin +HEAD
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay