Is there a way to give git metadata to mark a line as not being automatically mergeable?
In git, the default behavior is to automatically merge files if possible, and this makes sense in most cases, but here is an example where an original committer may know that automatic merging of a certain line in the file may be incorrect.
For example, adding an entry somewhere in a list may not work in conjunction with someone else adding a different entry to the list. It may be that they just logically can’t work together without some adjustment. However, if these changes were on different lines of the list, git will be happy to automatically merge the file and the person doing the merging may not even see the potential problem until later testing.
It would be nice if there was a way to catch this earlier on. For instance, one of those committers may know that entries added to the list can’t be automerged and have to be handled correctly. Thus, the potential merge issue could be handled much earlier on if there was a way to mark a particular line as unmergeable, so that another person merging their changes would see a merge conflict on that line in the file that they would be forced to manually review.
- Git unmerged path issue
- Best solution for “No Scheme” issue in Xcode 4 after defected merging git branches
- Is creating git diff patches then manually editing the before applying a valid workflow?
- Push git repository to remote subversion with history
- Merge some files now and some later
- Git fast forward merge: Any chance to find the person to blame?
Someone could develop their own flow of merging a particular file from two commits by hand, but this merge committer may not know all the details about changes that someone else made on a branch.
It would be better if the original committer could somehow mark those lines with metadata that forced a manual merge.
Marking a whole file as requring a manual merge would be another option that’s almost as good, though a coarser-grained approach.
It is great, in most cases, that git can auto detect all the information it needs about file changes and history, however, it would be good if you could also explicitly give it some sort of metadata when, as a user, you know more information that it is going to be able to auto detect.