How to roll back commits on github.com

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

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

    roll back the changes in the repository for an example two commit backwards
    git reset --hard HEAD ~ 2

    You can make up to a specific commit by hash
    git reset --hard HEAD hash
    Hash can be taken on the web interface of the github.

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

    Also popular now: