简体   繁体   English

拉取请求合并冲突问题 - 不显示当前主分支数据

[英]Pull Request merge conflict issues - Not showing current master branch data

Scenario is that I have three branches.场景是我有三个分支。 main , A , and B . mainAB

A and B are feature branches created off main at the same time. AB是同时从main创建的功能分支。 I updated file 1 in branch A and B .我更新了分支AB中的file 1

I then created a pull request from A into main without any conflicts.然后我创建了一个从Amain的拉取请求,没有任何冲突。 Now when I try to create a PR from B into main I get an error about having merge conflicts that need to be resolved.现在,当我尝试从B创建 PR 到main时,我收到一个关于需要解决合并冲突的错误。 I am using the VSCode GitHub Pull Request extension and what it shows me when I click on a modified file is in the screenshot below.我正在使用 VSCode GitHub 拉取请求扩展,当我单击修改后的文件时它向我显示的内容在下面的屏幕截图中。

在此处输入图像描述

I do not see any way to accept incoming changes or to keep current changes but I have seen this when trying to rebase.我看不到任何接受传入更改或保留当前更改的方法,但我在尝试重新设置基准时看到了这一点。 Is there anyway to see this so that I could fix conflicts on each file and just approve or delete the conflicted lines?反正有没有看到这个,以便我可以解决每个文件上的冲突并批准或删除冲突的行?

Additionally, after the first PR approval from A into main if I try to merge B into main it shows me old data from file 1 on the image above at the left hand side.此外,在A的第一次 PR 批准后,如果我尝试将B合并到main中,它会在左侧的main向我显示file 1中的旧数据。 It does not show updated information on that file from what is in my remote repository after the PR approval.在 PR 批准后,它不会从我的远程存储库中显示该文件的更新信息。

Is the only way to fix this through running a rebase?是通过运行 rebase 来解决这个问题的唯一方法吗? It has become a bit of a pain because I have to go through 50 to 100 conflicts that need to be resolved in the rebase.这变得有点痛苦,因为我必须通过 50 到 100 个需要在 rebase 中解决的冲突来处理 go。 It looks like these conflicts during each git rebase --continue are on generally the same set of files with just different commits.看起来在每个git rebase --continue期间的这些冲突通常在同一组文件上,只是提交不同。

Thanks @torek, discussion above in the OP may be useful to others.感谢@torek,OP 中的上述讨论可能对其他人有用。

Couple of ways to solve this, main confusion was with what a PR and merge were doing on either the git or GitHub side.解决此问题的几种方法,主要混淆是 PR 和合并在 git 或 GitHub 端所做的事情。

From the CLI I was able to run git checkout <FEATURE> , git merge main , then resolve conflicts in a testing manner.从 CLI 我能够运行git checkout <FEATURE>git merge main ,然后以测试方式解决冲突。 Optional to commit and push back to remote.可选择提交并推回远程。 If you do push to remote the PR will update saying no conflicts are present if all conflicts were fixed.如果您确实推送到远程,PR 将更新说如果所有冲突都已修复,则不存在冲突。 PR can be approved. PR可以被批准。

Alternatively if you don't want to merge main into FEATURE to test you can run git checkout main , git merge --no-ff <FEATURE> , resolve conflicts again, commit and push.或者,如果您不想将 main 合并到FEATURE中进行测试,您可以运行git checkout maingit merge --no-ff <FEATURE> ,再次解决冲突,提交并推送。 PR for me automatically merged. PR for me 自动合并。

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

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