+1 vote
in General by (11.2k points)
I pushed some changes to Github, but now I want to restore the previous changes. How can I revert to the previous commit?

1 Answer

0 votes
by (17k points)

You can undo your latest changes by using the following two commands:

1.  git reset --hard [previous Commit SHA id]

e.g. git reset --hard bea3c1e

2.  git push origin [branch Name] -f

e.g. git push origin master -f

...