splitting single file into multipe files on git commit, and merging them again on git checkout

39 Views Asked by At

A proprietary industry sensor configuration software stores various settings in about 500 XML files.

Multiple developers have to edit these settings (using that software). I want to use git version control on the xml files.

The xml files unfortunately contain a section that is hardware-specific for the PC of the current editor, which cannot be edited on a different pc. We cannot modify the software that generates the files.

Can I somehow split each file into two files when committing, and merge them automatically on checkout?

input: foo.xml
<xml>
<localSection>...</localSection>
<sharedSection>...</sharedSection>
</xml>

stored locally: foo-local.xml
<xml>
<localSection>...</localSection>
</xml>

committed to git-repo: foo-shared.xml
<xml>
<sharedSection>...</sharedSection>
</xml>

The local input file foo.xml should be split into foo-local.xml and foo-shared.xml, only foo-shared.xml should be committed to the git repo, while foo-local.xml should be stored in a separate local folder.

When there are local changes only to the <localSection> of the foo.xml file, the foo-local.xml should be updated, but no changes should be shown in git.

When a modified foo-shared.xml is checked out, it should automatically be merged with the stored foo-local.xml, into a single foo.xml that can be used by the proprietary software.

0

There are 0 best solutions below