问题
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 toFeatureA
- 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 FeatureA
have 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