How to permanently remove few commits from remote branch

后端 未结 8 1706
予麋鹿
予麋鹿 2020-11-27 09:07

I know that\'s rewriting of history which is bad yada yada.

But how to permanently remove few commits from remote branch?

8条回答
  •  时光取名叫无心
    2020-11-27 09:30

    Simplifying from pctroll's answer, similarly based on this blog post.

    # look up the commit id in git log or on github, e.g. 42480f3, then do
    git checkout master
    git checkout your_branch
    git revert 42480f3
    # a text editor will open, close it with ctrl+x (editor dependent)
    git push origin your_branch
    # or replace origin with your remote
    

提交回复
热议问题