Like most, I am using git
on a multi-project development with many developers and many changes being propagated to the main branches daily. Many times, when I merge a parent branch into a feature (or bug fix) branch, I get conflicts on several files I did not touch or even look at!
Background
Branch setup:
git checkout master
git checkout -b myFeatureBranch
Let's say two or more days go by. My feature code is now ready for review. Note: I am using master
here only for clarity, in reality, it is another uniquely named release branch. Many other developer merge THEIR bug fixes and feature branches into master
(after their code reviews are approved!). These changes may have impacted one or more of the files I changed in my feature branch. Thus, I need to merge master
into my branch to get all the latest code.
My Question
I did not find an answer to this specific question. I looked at this question which also pointed to this question. Following that information there, if I need to merge master
into my feature branch, then following that logic, I would do:
git checkout myFeatureBranch
git merge -X theirs master
I believe (from man
page) that:
This option forces conflicting hunks to be auto-resolved cleanly by
favoring `their` version.
But this isn't really what anyone wants is it?
If the file is untouched by me in my branch, then yes this is exactly what I want; however, if I modified a file (and committed to my branch), then I want the normal merge (and conflict resolution) process to be done. I don't want to favor theirs
in this case. Does the above do that? If not, is there a single merge command to do so?