0

Does anyone know if the following mechanism would be possible?

Precondition A Git repository contains

  • normal code files which shall be merged with the standard git merge mechanisms
  • a data model which exists of several xml files and a project file (which shall be merged in whole with an own merge Script)

How it should work User enters normal git merge (or alternativ a custom git alias) and the Code files are merged with git standard mechansims and the complete Data model with an own Script. For the script it is necessary that all model files are merged in one step (a file-by-file merge is not possible as the merge script needs to know the complete model)

Anyone knows if this is technical possible with git? I know that merge drivers can be written but there I would not know how to proceed if no file by file merge is needed.

bakerinc
  • 11
  • 1

1 Answers1

0

It is technically possible, and there are several approaches to it.

First, you may want to decide whether you want to keep your data separated from your code. If the answer is yes, you may want to have some sample data as examples, or even better, as data for tests (for testing that the code keeps working if it is modified).

If you want to keep separated, it may be better to use different repos for code and data. Then you may have a wrapper repo that downloads both. If you want to keep everything together, you may have a branch for code and a branch for data, but that may make things complicated.

carnicer
  • 494
  • 3
  • 9
  • Thanks for your detailed answer. The code and model data belongs to each other, so they shall be consistent per commit and also in one Mono-repo. So I don‘t get the point on your answer or can find any idea/solution in it. I want be able to merge my data with another commit with git merge or a customized git merge as stated in my initial question. – bakerinc Dec 20 '21 at 08:37