0 votes
1 view
in Devops and Agile by (29.9k 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 (51.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.

Refer: https://git-scm.com/docs/git-push#Documentation/git-push.txt--f

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


Categories

...