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.
By the LADX engineering team
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.
Sources and further reading
- Rockwell Logix 5000 Import/Export reference (L5X/L5K)literature.rockwellautomation.com
- Beckhoff TwinCAT 3 Source Control manualinfosys.beckhoff.com
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
- Migration
L5X file: what it is and how to open, edit or convert one
An L5X is Studio 5000's XML export. What is inside it, how it differs from L5K and ACD, and how to open, import, hand-edit or convert one safely.
- Platforms
TwinCAT: a PLC that is really a PC
Beckhoff's approach puts the controller inside Windows, which changes what is easy and what is worrying.
- Practice
PLC simulators: what each one is actually for
Vendor simulators, virtual factories and browser tools solve different problems, and picking the wrong one wastes weeks.