Version control for PLC code, realistically
Git works better than most engineers expect on some platforms and barely at all on others, and knowing which is which saves an argument.
Short answer
It depends entirely on whether the platform stores projects as text. Beckhoff TwinCAT files are XML and diff meaningfully. Rockwell L5X exports are XML and work if you export deliberately. Siemens and most others store binary projects, where Git can store versions but cannot show you what changed, which is most of the value.
The honest answer is 'it depends on your platform', and the dependency is simple: does it store text?
Where it works properly
TwinCAT. Project files are XML. .TcPOU, .TcDUT and .TcGVL diff line by line, merge, and can be reviewed in a pull request like any other code.
Rockwell, with discipline. The .ACD is binary, but .L5X exports are XML. If exporting is part of the commit ritual, the history is readable.
Where it does not
Most others store binary project files. Git will happily version them and can tell you that something changed, but not what, which removes most of the reason to use Git rather than dated folders.
The workable compromise
Commit the binary as the artefact and a text export beside it as the record.
The discipline is the hard part, not the tooling. An export that happens only when somebody remembers is a history with holes exactly where the interesting changes are.
Why it is worth the effort
Not for merging. Almost nobody merges PLC code. For answering 'what changed between the version that worked and the version that does not', which is a question every commissioning engineer asks eventually.
Common questions
- Which PLC platforms work well with Git?
- Beckhoff TwinCAT works best, because .TcPOU, .TcDUT and .TcGVL files are plain XML that diffs and merges. Rockwell works if you export to L5X as part of your workflow. Siemens TIA Portal stores binary projects, so Git holds versions but cannot show meaningful differences.
- How do I version control a binary PLC project?
- Store the binary in Git for history, and alongside it store a text export that a human can diff. For Rockwell that is an L5X; for Siemens, SimaticML block exports. The binary is the artefact, the export is the record, and the discipline is exporting on every commit.
Keep reading
- Safety
SIL or PL: which one does your machine need?
Two standards, two scales, and one machine. Which one applies, how they map to each other, and why the answer is usually ISO 13849.
- Safety
Categories B, 1, 2, 3 and 4, in plain terms
Five architectures, what a single fault does to each, and the practical wiring that goes with them.
- Safety
Safety relay or safety PLC: how to decide
One is a wiring decision, the other is a programming one. The count of safety functions, not the size of the machine, is what settles it.