Revert a merge after being pushed

前端 未结 4 1696
灰色年华
灰色年华 2021-01-30 05:19

Steps i performed:

I have two branches branch1 and branch2,

$git branch --Initial state
$branch1

$git checkout branch2
$git pull origin branch1 --Step1
         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 05:22

    Try using git reflog to find out where your branch was before the merge and git reset --hard to restore the old revision.

    Reflog will show you older states of the branch, so you can return it to any change set you like.

    Make sure you are in correct branch when you use git reset

    To change remote repository history, you can do git push -f, however this is not recommended because someone can alredy have downloaded changes, pushed by you.

提交回复
热议问题