Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)

I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories?

$ git log

commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8

Author: chandra <[email protected]>

Date:   Tue Jul 23 12:24:23 2019 -0700

1 Answer

0 votes
by (50.2k points)

 Use the following commands:

git reset --hard HEAD~1

git push -f <remote> <branch>

This will undo the last commit and update the history to the remote.

-f option is used because you’re applying changes to the history in the remote.


Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.2k users

Browse Categories