How to permanently remove few commits from remote branch

后端 未结 8 1568
予麋鹿
予麋鹿 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
    
    0 讨论(0)
  • 2020-11-27 09:34

    This might be too little too late but what helped me is the cool sounding 'nuclear' option. Basically using the command filter-branch you can remove files or change something over a large number of files throughout your entire git history.

    It is best explained here.

    0 讨论(0)
提交回复
热议问题