简体   繁体   中英

How to revert a merge commit?

I accidentally merged my branch to master. Since then several commits has been pushed by other team members. How can I revert just the commit I merged accidentally.

git log: commit 5 commit 4 commit 3 commit 2(Accidental Merge branch ) commit 1

How to revert commit 2? I tried the command git revert

I get an error error: commit 9576fbad0f1dd6f09412d9c87411e3c79fc6c961 is a merge but no -m option was given.

use:

git revert 9576fbad0f1dd6f09412d9c87411e3c79fc6c961 -m 1

and don't forget to push you changes after that.

Read more

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