I am considering using git for version control of a project which is not source code. In this project, there is an xml file which stores objects with unique IDs. I am afraid that if two branches both add an object of the same type, these new objects would have the same IDs and in merging these IDs would clash.
Is there a way to avoid this ID clashing in a relatively straightforward way?
Edit: Here is the workflow I am thinking:
- External software is used to develop an xml file. A sample of this XML file is below.
- The xml file (and complimentary files) are in a folder with which
git init
is called. - This git repo is pushed to a remote repository.
- A variety of team members fork/branch off of the remote repository on their local devices. They make edits, including adding objects. The external software automatically assigns object ids which are 1 more than the max ID (of that object type).
Team members commit changes locally, and eventually push back to the remote repo to merge into the master branch.
How do I manage this merge to prevent the clashing of two object IDs within the XML file if two users added the same type of object?
File example:
<net>
<ObjectAs>
<ObjectA id=1 some=thing>
<ObjectA id=2 some=else>
</ObjectAs>
<ObjectBs>
<ObjectB id=1 some=thing>
<ObjectB id=2 some=else>
</ObjectBs>
</net>
Possible commit from editor A:
<net>
<ObjectAs>
<ObjectA id=1 some=thing>
<ObjectA id=2 some=else>
+++<ObjectA id=2 some=1>
</ObjectAs>
<ObjectBs>
<ObjectB id=1 some=thing>
<ObjectB id=2 some=else>
</ObjectBs>
</net>
Possible commit from editor B:
<net>
<ObjectAs>
<ObjectA id=1 some=thing>
<ObjectA id=2 some=else>
+++<ObjectA id=2 some=2>
</ObjectAs>
<ObjectBs>
<ObjectB id=1 some=thing>
<ObjectB id=2 some=else>
</ObjectBs>
</net>
Clearly these edits would conflict by adding two ObjectA objects with the same id. However, if I understand git correctly it would happily merge these together and add both rows.
How do I manage this merge to prevent the clashing of two object IDs within the XML file if two users added the same type of object?