We maintain web application which has common master branch and many parallel branches, one for each installation, each have few specific changes. Source code is managed in git and it is terrific tool when we need transfer features and bugfixes from master branch into parallel ones. But are few files that are sensitive and automatic merging usually give bad results. So merging would be much easier if they can be somehow marked and every merge would result in conflict requiring manual merge.
I searched for an answer :
- I am using --no-commit and --no-ff merge options, but it is not the same.
- Here and here someone asks the same question but with no solution.
- Similar case seems to be how to prevent file being merged using .gitattributes containing: somefile.php merge=ours . I tried to find some merge option which would generate conflict or force manual merge but found none so far.
- .gitattributes containing: somefile.php -merge is never merged automatically and therefore forcing manual merge. It is 90% solution, but what I seek is to try automatic merge and mark it as conflict regardless it is successful or not. But this is so far closest to solution. (...thanks Charles Bailey for clarification...)
- Someone suggest to write custom merge driver (1, 2), but how to do it is far from clear to me.
edit: variant 4. description
git fetch
first, then usegit difftool <file> FETCH_HEAD
, so I can manually apply the change in the remote branch to the local. – Melmela-merge
doesn't prevent you from merging the files, it just forces you to do it manually, e.g. with a mergetool. Isn't this what you need? – Millar-merge
in.gitatttributes
git merge
does nothing, and all work must be down with the merge tool? So there is no <<<<< ===== >>>> for the merge tool to use, right? And Dan's solution does provide this? – Cicily** -merge
in.gitattributes
in the root directory of a repository, and then merge another branch. This obviously raises conflicts for every file which has been changed (even if the change happened at one side only). But how does it behave with files which have not been touched at either side since the common ancestor commit? – Caralie