How to revert a merge commit that's already pushed to remote branch?

后端 未结 17 1911
无人及你
无人及你 2020-11-22 07:04

git revert alone won\'t work. -m must be specified, and I\'m pretty confused about it.

Anyone experienced this before?<

17条回答
  •  孤城傲影
    2020-11-22 07:51

    Here's a complete example in the hope that it helps someone:

    git revert -m 1  
    git push -u origin master
    

    Where is the commit hash of the merge that you would like to revert, and as stated in the explanation of this answer, -m 1 indicates that you'd like to revert to the tree of the first parent prior to the merge.

    The git revert ... line essentially commits your changes while the second line makes your changes public by pushing them to the remote branch.

提交回复
热议问题