1

Consider this repository: Main Branch A holds a single source file. Branch B is forked off A. On Branch B I remove some lines of code. I merge A to B and resolve any conflicts.

I would like to configure GIT automated merge resolution for my project when merging A into B such that:

  • Any further modifications to the lines deleted in B from within A will be auto discarded on later merges, i.e. remember that the lines were deleted in B. At the moment I get a merge conflict every time those deleted lines are modified in A and then merged.
  • Ideally if new lines are added in A and in B in the same place in the file, e.g. the end, the merge will be auto resolved by laying them out one beneath the other.

I appreciate that sort of behaviour would often be undesirable when merging code, but we are dealing with an XML config format where these cases are very common.

Is it possible to configure GIT to accommodate that logic?

Andrew
  • 547
  • 4
  • 13
  • Could you add an example? I'm having following your question. – ChrisGPT was on strike Oct 21 '15 at 18:58
  • @Chris I have set up demo here (see commit log): https://github.com/mcallistera/mergetest.git .. Basically there is a file that I remove a node from on the branch. Then I modify deleted row on trunk and merge, which results in conflict. Then I've added new lines to the same location in each file which also clash.. that case is I think trickier and a lower priority to manage. Thanks! – Andrew Oct 21 '15 at 19:48

1 Answers1

1

I have not used this command myself, but there is this git rerere command that is supposed to keep a record of already resolved conflicts and reapply them again later. I am not sure if this is a solution to your problem, but I suggest examining it.

If rerere does not work, I think you should focus on getting/creating an XML aware merge handler. Merging XML files is a non-trivial task, but you might have luck with some of the options available.

Community
  • 1
  • 1
hlovdal
  • 26,565
  • 10
  • 94
  • 165