Reputation: 372
Let's say in a git repo I have a file containing version information:
version=42
Now if on two separate branches the version is incremented to
version=43
and these branches are merged, the standard merge mechanism of git would not yield a merge conflict, since both versions are the same (even though the merge base is different).
Normally this is wanted behavior, but in the case of this file I want to get a merge conflict whenever both branches differ from the merge base. Is there any merge strategy that always ends in a merge conflict when a line is edited in both branches (even if they are the same)?
Upvotes: 9
Views: 935
Reputation: 488193
No. In fact, not only is there no such strategy built in to Git, the rest of Git's support routines—which you might want to use to write such a strategy—don't help you out here. Existing merge drivers mostly use git read-tree
(or its internal equivalent) to perform as much of the work as possible inside the index, and it's git read-tree
itself that collapses such results back to a fully merged stage zero entry, saving having to re-code that same thing into the recursive and resolve merge drivers.
The culprit code is here.
Upvotes: 7