📜 ⬆️ ⬇️

How to rollback commits on github.com

The situation when you already have a clone of the repository with which you work, pull and see that there is some kind of garbage on the developers.

We select the desired brunch (branch), I have it master
git checkout master

do a rollback of changes in the repository for an example on two commits back
git reset --hard HEAD ~ 2
')
You can make up to a certain hash commit
git reset --hard HEAD hash
Hash can be taken in the githaba web interface.

Next, we make a forced commit in the main repo on the githaba.
git push -f origin master
without -f will swear that you have a younger version than github and you need to pull

Source: https://habr.com/ru/post/138590/


All Articles