为什么成功的合并会破坏我的代码?
当使用 XCode4 时,我创建了一个新分支并在这个新分支上实现了一个非常小的方法。我看到该分支工作正常,因此我在这个新分支上进行了提交,然后切换回主分支。我将两个分支合并在一起(新分支合并到我的主分支中)。现在我的项目无法运行。
昨天也发生了同样的事情。我从未发现问题,所以我从头开始当前的项目。是什么原因造成的?
When using XCode4 I created a new branch and implemented a very small method on this new branch. I saw that the branch was working properly so I made a commit on this new branch and then switched back to my main branch. I merged the two branches together (the new one into my main branch). Now my project is not working.
The exact same thing happened yesterday. I never found the problem so I started over from the beginning on this current project. What is causing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您开始开发分支的位置:
如果来自
main
分支的HEAD
,那么应该合并回main
已经是一个快进的项目(即main HEAD
应该简单地移动到dev HEAD
),并且您的项目应该可以工作。如果这是来自
main HEAD
之前的任何提交(即,如果main HEAD
在dev
分支期间移动了开发),那么合并不是快进合并,并且您正在组合(如果两个分支中的更改是独立的,则自动合并)两组不同的更改。然后需要再次测试和验证结果。
It depends on where you started your development branch:
if that was from
HEAD
ofmain
branch, then the merge back intomain
should have been a fast-forward one (i.e.main HEAD
should have simply be moved atdev HEAD
), and your project should have worked.if that was from any commit before
main HEAD
(i.e. ifmain HEAD
has moved duringdev
branch development), then the merge isn't a fast forward one, and you are combining (automatically if the changes in both branches are separate) two different sets of changes.Then the result needs to be tested and validated again.