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

后端 未结 17 1663
无人及你
无人及你 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:58

    Sometimes the most effective way to rollback is to step back and replace.

    git log

    Use the 2nd commit hash (full hash, the one you want to revert back to, before the mistake listed) and then rebranch from there.

    git checkout -b newbranch

    Then delete the old branch, copy the newbranch over in its place and restart from there.

    git branch -D oldbranch
    git checkout -b oldbranch newbranch
    

    If its been broadcast, then delete the old branch from all repositories, push the redone branch to the most central, and pull it back down to all.

提交回复
热议问题