Resetting remote to a certain commit

October 12, 2023

Resetting remote to a certain commit

Let’s assume that your branch is called  test both locally and remotely, and that your remote is called origin you could do:


git reflog to get all the commit history, your commit hash has format like this: e34e1ff

 git reset --hard <commit-hash>
 git push -f origin test

Written by Manoj Bhardwaj who lives and works in Dharamshala Himachal Pradesh (India). My stackoverflow