Can changes be conflictless overwritten when using git merge with recursive strategy?

巧了我就是萌 提交于 2020-01-07 03:58:44

问题


I am managing the source code of a project in my company with Git (GitLab) to be precise. Two developers work on the project, create a branch for every task then create a merge request. I mostly merge these directly via the UI which should be the same as doing this in the command line:

git checkout master
git merge --no-ff 1224-cool-feature-branch

From time to time I have seen small features or parts of pages disappear.

Consider the following case

  • Dev A branches from master at ab12 -> new branchname FeatureA
  • Dev B branches from master at ab12 -> new branchname FeatureB
  • Dev A changes foobar.txt and commits to FeatureA
  • FeatureA is merged into master using merge --no-ff using the default recursive strategy
  • Dev B changes foobar.txt and commits to Feature B
  • FeatureB is merged into master using merge --no-ff using the default recursive strategy without conflict

Is it possible that changes to foobar.txt from FeatureAhave been overwritten without creating a conflict?


回答1:


I believe the answer is "no". The file is merged using the conventional 3 way merge which should apply change if they are distant enough from each other or report a conflict, there is no other option.

There could be some issues with this approach, see for example http://r6.ca/blog/20110416T204742Z.html , but I cannot imagine how any corner case would result in silent edit reversal.



来源:https://stackoverflow.com/questions/45453017/can-changes-be-conflictless-overwritten-when-using-git-merge-with-recursive-stra

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!