git GitLab 无法自动合并。合并请求包含必须解决的合并冲突
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33757557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GitLab unable to automerge. Merge request contains merge conflicts that must be resolved
提问by Mike Rynart
GitLab is unable to automerge requests. All merge requests get the message "This merge request contains merge conflicts that must be resolved. You can try it manually on the command line"
GitLab 无法自动合并请求。所有合并请求都收到消息“此合并请求包含必须解决的合并冲突。您可以在命令行上手动尝试”
The message seems incorrect, and I tested this by creating a new branch with "git branch -b new-branch-name" and change a file that is not going to cause merge conflicts.
该消息似乎不正确,我通过使用“git branch -b new-branch-name”创建一个新分支并更改不会导致合并冲突的文件来对此进行测试。
When I push this new branch and create a new merge request, Gitlab still says it cannot auto merge.
当我推送这个新分支并创建一个新的合并请求时,Gitlab 仍然说它不能自动合并。
Any recommendations to fix this and what the reason is GitLab gives the "This merge request contains merge conflicts" message?
任何解决此问题的建议以及 GitLab 给出“此合并请求包含合并冲突”消息的原因是什么?
回答by Imamudin Naseem
This happens when your current branch is not in sync with remote branch. In this case, sometimes Git gets confused what to retain and what to ignore.
当您当前的分支与远程分支不同步时,就会发生这种情况。在这种情况下,有时 Git 会混淆要保留什么和忽略什么。
To fix this do following
要解决此问题,请执行以下操作
; Go to master branch
git checkout develop
; update master branch
git pull
; go to you local branch and merge it with changes from master
git checkout local-branch
git merge develop
Resolve the conflicts if you get any. - Reference
如果有冲突,请解决冲突。-参考
Your merge conflicts should be fixed by now.
您的合并冲突现在应该已解决。