Merging KiCad schematic files (version control)

Would you mind expand on that - my use of VCS is using Subversion, and only for software, but I would like to make it so that all of our work can be properly version controlled.

You just have to avoid situations where merging would be needed. Locking is a reliable built-in formal way to prevent clashes and need for merging. Other options are for example ad-hoc communication (ā€œIā€™m working on this now, donā€™t touch itā€) or formal in house communication. But human communication isnā€™t 100% reliable. In any case there isnā€™t a way to make uncontrolled distributed development work with KiCad ā€“ files canā€™t be merged reliably.

Well, not at the moment no. But something can certainly be done about this by changes in the architecture of the code so that they can.

@joojala Since we are asking for the feature, I would like to ask more.
Can we also including the pcb layout in the same data structure so we can also git the layout file?
Thanks

Is this also true for libraries? My understanding is that they can be merged, but confirmation would be helpful.

1 Like

Can this be done? of course it can be. Is it trivial? HELL NO!

KiCad is a graphics program with the format being a textual structure but that structure interacts with other aspects of the structure and for a human to approve a merge conflict there must be a way of VISUALISING the difference and then a tool to correctly merge the conflict

The best example of this is Matlab Simulink. The fileformat is xml so by the logic that is being presented in this thread ā€œsurely this can be merged?ā€ um noā€¦ this isnā€™t like sourcecode where a line of code is atomicā€¦ it interacts with other lines (ignoring the impact at compile/linkage).
It took Matlab several years to provide means to manage what is referred as ā€œthree way mergeā€

KiCad devā€™s would have to provide something like below and then the associated code to merge the accepted changes to ensure the result is a valid schematic/layout

We are considering graphical diff/merge and other features to make version control easier built-in to KiCad. We are not planning on handling it in the files (textually).

1 Like

We are not really asking the devs to do this for us. Originally i was asking does this kind of work exist. Then we started to think about how it could be done more easily.

Right now there is no path put forward that could even feasibly end up in this merge situation. I mean I cant even easily merge files manually. Because i cant import 3 files in and delete what i dont want and harmonize the UUIDā€™s manually

I merge svg, and binary illustrator files all the time, part of it goes easy part of it is complex. And i dont actually need any really super custom tools for this.

So we are looking at low hanging fruits here. So it turns out that all but one of my 48 test cases merge perfectly fine, if i chunk by items in the s-expressions*. But only if I change the file sorting so that the UUID is not the key to sort for. I am now playing with a version that uses running numbers instead of UUID for identifiers, but because i only changed ten lines of code this int exactly super robust but works for my testing purposes.

* so the others are correct is saying that donā€™t touch others data and use schematic sheets. But there are also the connections that need to be put on the master sheet that need to be harmonized

Im also not really doing text merges, its just expedient for testing.

More pressing though would be able to open several files on top of eachother in same window.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.