简体   繁体   中英

Cannot revert after merge in Git

This is my situation. I'm working on the MiniMaxAB branch (green line)

在此处输入图片说明

I accidentally merged a branch (purple) into mine (green) and pushed it. Which is stupid (i just started learning git) and bad for our goal. Now i would love to revert this and undo this merge. Therefore i picked up the hash of the latest commit in the green branch before the merge (which is not visible in this chart because 15days old) and tried to revert:

git revert 86ed202152e719ae719654f7805bd2991f63fd29

Unfortunately it doesn't work... This is what git says:

在此处输入图片说明

So i tried with reset, which works

git reset 86ed202152e719ae719654f7805bd2991f63fd29

But when i push, i get this error:

在此处输入图片说明

How can i fix it?

You should follow the steps below:

Step 1: Manually merge your conflict file minmax_ab_engine.e and ticktactoe.e (Open those files and edit them)

Step 2: Add to stage by git add -A

Step 3: Commit those files by git commit -m 'merge conflict files

Step 4: Pull the update from the remote by git pull origin MiniMaxAb

Step 5: Push your update to remote git push origin MiniMaxAb

In case you want to revert, you can bypass step 4,5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM