简体   繁体   English

如何还原合并提交?

[英]How to revert a merge commit?

I accidentally merged my branch to master. 我不小心将分支合并到了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 git log:提交5提交4提交3提交2(意外合并分支)提交1

How to revert commit 2? 如何还原提交2? I tried the command git revert 我尝试了git revert命令

I get an error error: commit 9576fbad0f1dd6f09412d9c87411e3c79fc6c961 is a merge but no -m option was given. 我收到一个错误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. 并且不要忘记在那之后push您的更改。

Read more 阅读更多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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