+2 votes
in General IT Tips by (71.8k 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

+1 vote
by (349k points)
selected by
 
Best answer

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

Related questions


...