DEV Community

Discussion on: How to move a commit to another branch in git

Collapse
 
sodjanathan profile image
nat_souljah

What if I have already sent the changes to remote

Collapse
 
haritsinh profile image
Haritsinh Gohil

I will pray for you.

Collapse
 
hnakao profile image
hnakao

git reset --hard HEAD~X // where X is the total of commit to move back

or

git reset --hard a1b2c3d4 // simply provide the hash of the commit you want to revert back to..

and

git push origin master --force // change "master" to the branch you want to revert.