How can I rollback a github repository to a specific commit?

后端 未结 6 1932
孤街浪徒
孤街浪徒 2020-11-28 16:44

My github has 100 commits in it right now. I need to rollback the repository to commit 80, and remove all the subsequent ones.

Why? This repo is supposed to be fo

6条回答
  •  一整个雨季
    2020-11-28 17:23

    Another way:

    Checkout the branch you want to revert, then reset your local working copy back to the commit that you want to be the latest one on the remote server (everything after it will go bye-bye). To do this, in SourceTree, I right-clicked on the and selected "Reset BRANCHNAME to this commit".

    Then navigate to your repository's local directory and run this command:

    git -c diff.mnemonicprefix=false -c core.quotepath=false push -v -f -- tags REPOSITORY_NAME BRANCHNAME:BRANCHNAME 
    

    This will erase all commits after the current one in your local repository but only for that one branch.

提交回复
热议问题