Restore To Commit Before Last

Hey,

Say I make changes then commit and push them, but want to go back to the previous commit, locally and remote. What’s the best way to do that? Thanks

If you want to undo the changes introduced by the last commit but still keep a record of it you can do

git revert HEAD

This will create a new commit that undoes the changes of the previous commit.

Then you will want to

git push origin <branch-name>

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.