PLC Version Control and CI/CD: Git Workflows for TIA Portal, Simatic AX, CODESYS, TwinCAT and Studio 5000

PLC Version Control and CI/CD: Git Workflows for TIA Portal, Simatic AX, CODESYS, TwinCAT and Studio 5000

PLC Version Control and CI/CD: Git Workflows for TIA Portal, Simatic AX, CODESYS, TwinCAT and Studio 5000

Most PLC programs in production today have no reliable answer to a simple question: what exactly is running on that controller, and who changed it last? Software teams solved this two decades ago with Git. Automation teams could not, because their projects lived in binary files that Git can store but cannot diff, merge or review. That is changing quickly. On 19 November 2026 Siemens announced TIA Portal V21.1, with text-based Simatic Source Documents extended to hardware configuration. A week later, CODESYS shipped File-Based Storage 1.1 tuned for CODESYS Git 2.0. PLC version control is finally a design decision rather than a workaround.

This guide is for controls engineers and OT software leads who want working plc version control and a plc git workflow, not a slide deck. It covers why PLC projects resist Git, the real text-export path for each major vendor, a branching model for machines already in the field, automated PLC testing, and a gated pipeline that respects safety and IEC 62443 change control.

What this covers: vendor export paths, repository layout, branching, unit and simulation testing, real pipeline YAML, deployment gates, drift detection and audit trails.

Context and Background

For most of the history of IEC 61131-3 programming, “plc version control” meant a shared drive full of files named Line3_final_v7_JK_fixed.zap18. Each vendor stored a project as a single proprietary container: TIA Portal’s .apXX folders and databases, Studio 5000’s .ACD binary, CODESYS’s .project file. Git happily stores those blobs. It just cannot tell you that rung 14 of the conveyor routine gained an extra contact, so every merge becomes “pick one file and lose the other person’s work.”

The industry worked around this in three ways. First came backup-and-compare products such as AUVESY-MDT’s versiondog, now marketed as octoplant, which upload controller programs on a schedule and compare them against a stored version. Second came vendor-specific multi-user servers, such as TIA Portal Multiuser Engineering and TwinCAT’s Multiuser feature. Third came Git-for-PLC platforms like Copia Automation, which render ladder logic and structured text diffs in a browser. Each solves part of the plc version control problem. None turns a PLC project into something a standard CI/CD server can build and test.

What changed in 2025 and 2026 is that the vendors themselves began exposing text. Siemens built Simatic AX as a VS Code-based environment with plain structured-text files and a package manager. CODESYS introduced a textual project format. Beckhoff has stored PLC objects as separate XML files for years. Rockwell published a Logix Designer SDK that can export L5X and drive downloads from Python or C#. If you are new to how controllers execute these programs, our explainer on PLC scan cycles, determinism and task scheduling is useful background. The Siemens announcement of TIA Portal V21.1 is the clearest signal yet that text sources are becoming the main engineering artifact rather than an export option.

The result for plc version control is uneven. Some platforms now offer full round-trip text. Others offer export-only text that is fine for review but cannot rebuild the project. Knowing which is which is the first job of any plc version control or plc ci/cd design.

A Reference Architecture for PLC Version Control and CI/CD

PLC version control works when three truths are reconciled continuously: the text sources in Git, the compiled project a licensed build agent produces from them, and the program actually running on the controller. Git manages intent. The build agent proves the intent compiles and passes tests. Drift detection proves the controller matches the release.

PLC version control reference architecture from engineer IDE through Git, licensed CI build agent, unit tests, simulated PLC, approval gate, controlled download and drift check

Figure 1: Reference architecture for PLC version control and CI/CD, with a drift-detection loop back from the running controller to the repository.

The diagram reads left to right. An engineer works in the vendor IDE and exports text sources to a Git repository. A merge request triggers a Windows build agent that holds the vendor licence. The agent imports the sources headlessly, compiles them, and runs unit tests. It then loads the program into a simulated controller for integration tests. A passing build produces a signed artifact with recorded checksums. A change-approval gate releases it for a controlled download. Finally, an upload-and-compare job closes the loop by flagging any difference between the controller and the tagged release.

Why PLC projects resist Git

The binary file problem is the obvious one, but it is not the hardest. Four other properties of PLC projects break naive plc version control workflows.

Online and offline divergence. A PLC can be edited while it runs. An online change in TIA Portal, a Logix online edit or a CODESYS online change modifies the controller without touching the repository. If the engineer forgets to save and commit, the controller is now the only copy of the truth. A software team never has production servers that silently rewrite their own source. This is the defining problem of plc version control.

Hardware configuration is code. Device trees, I/O addressing, network parameters, drive configuration and safety parameters live in the same project as the logic. In many tools they are the least exportable part. Until TIA Portal V21.1, Siemens text sources did not cover hardware configuration. That gap meant a plc version control repo could hold all the logic and still be unable to rebuild a working project.

Safety signatures. Safety programs carry checksums that prove the validated code has not changed. In STEP 7 Safety this is the collective F-signature; Rockwell GuardLogix and other safety controllers use equivalent safety signatures. Any rebuild that changes the signature, even with identical logic, can invalidate a validation record. Your plc version control pipeline must treat the signature as a first-class output, not a side effect.

GUIDs and generated noise. Many tools tag objects with GUIDs, timestamps and tool-version stamps. Beckhoff’s own source-control guidance notes that TwinCAT objects are identified by GUID, so deleting and recreating an object with identical content still counts as a change. Without normalisation, a “no-op” save produces a diff that buries the real change.

Round-trip text versus review-only text

The most important plc version control design question is whether your text export can rebuild the project. Call it the round-trip test: delete the project, import the text into a clean workspace, compile, and compare the result with the original. If it passes, Git can be the source of truth. If it does not, Git is a review and audit layer next to a binary master.

Round-trip platforms let plc version control drive real CI: build from source, test, and produce the download artifact. Review-only platforms still benefit from plc version control in Git, because diffs, blame and code review catch mistakes. But the binary project, stored with Git LFS or in a vendor server, remains the thing you actually download. Mixing the two plc version control models without saying so is the most common cause of “the repo says one thing, the machine does another.”

The licensed build agent is the hard dependency

Every vendor toolchain in this article except Simatic AX’s test runner needs a Windows host with an installed IDE and a valid licence to compile. CODESYS states this directly: CI build agents need a CODESYS installation with the File-Based Storage add-on and a valid licence. That rules out ephemeral Linux containers for most PLC builds. For plc version control at scale, plan for persistent, self-hosted Windows runners, one or more per vendor version, with the exact IDE version, updates and hardware support packages your projects require.

Treat those runners as controlled assets. Pin their IDE versions, snapshot them, and record the toolchain version in every build log. If you run GitHub Actions at scale, the patterns in our guide to OIDC federation, reusable workflows and runner security apply directly to these runners.

Vendor-by-Vendor Text Export Paths

There is no common plc version control export format across vendors. PLCopen XML exists, but in practice each toolchain has its own best path. Figure 2 summarises them before the detail.

PLC git workflow export paths for TIA Portal, Simatic AX, CODESYS, TwinCAT and Studio 5000 into a Git repository

Figure 2: Text export paths per vendor. Each path ends in Git, but only some support a full round trip back into the engineering tool.

Siemens TIA Portal: Openness, VCI and Simatic Source Documents

TIA Portal gives you three overlapping mechanisms. TIA Portal Openness is a .NET API that can open projects, export and import blocks, tags and types as SimaticML XML, and compile. It is the engine behind almost every TIA automation script. The Version Control Interface (VCI) is a built-in feature that links a project to a folder workspace. You synchronise objects into that folder, choose an export format, compare objects with workspace files using an external diff tool, and extend it with add-ins. VCI does not talk to Git itself. You point Git at the workspace folder, or use a community add-in such as the open-source TIA VCI Git connector.

Simatic Source Documents (SIMATIC SD) are the newer, more readable format. A program block exports as a pair of files: an .s7dcl declaration file and an .s7res resources file. Siemens documents SD representation for LAD program code on S7-1200 and S7-1500. Per Siemens’ 19 November 2026 announcement, V21.1 extends Source Documents to hardware configuration, “which simplifies integration with external tools such as Git.” That is the missing piece for round-trip TIA Portal Git workflows. The press release also says V21.1 removes the need to upgrade and revalidate projects for each new release within the V21 line, which matters for pipelines pinned to a toolchain version.

Be careful with plc version control expectations here. The press release does not describe a CI/CD runner, a Git client inside TIA Portal, or a headless compiler service. Those still come from Openness scripts you write or buy. Test SD round-trip on your own projects, including safety and technology objects, before you declare Git the source of truth. Siemens’ Eigen Engineering Agent, launched on 20 April 2026 and connected to V21.1, reads and modifies project structures. That makes reviewable text diffs more important, not less: an agent that edits blocks needs the same merge request and approval as a human.

Simatic AX: native files and apax

Simatic AX is the closest thing in industrial automation to a normal software project, and the easiest place to practise plc version control. It runs on VS Code, stores structured text as plain .st files, and uses the apax package manager with an apax.yml manifest. Siemens publishes open-source GitHub Actions for apax-login, apax-install, apax-build, apax-make, apax-test, apax-pack and apax-publish. Version 4.4.1 of those actions, released 26 October 2026, added apax make as the successor to apax build.

AX unit tests use AxUnit. Siemens’ learning material states that tests can run through apax, locally or in a pipeline, without PLCSIM Advanced or a real PLC, using an llvm target. That makes AX the only platform here where meaningful PLC unit tests run in a Linux container. Note that Siemens’ developer site still describes Simatic AX as early access, released for selected productive use cases.

CODESYS: Git 2.0 and File-Based Storage

CODESYS historically stored a project as one binary .project file, which made plc version control outside the IDE impractical. CODESYS Git 1.x worked around that inside the IDE, but external tools still saw binary blobs. CODESYS File-Based Storage changes the format. According to the CODESYS Store, a project saves as a folder tree that mirrors the project tree. IEC source code is plain text, project metadata is JSON, and object types without a suitable format fall back to the XML export format.

File-Based Storage 1.0.0.0 shipped on 6 August 2026 with a cleaner, diff-friendly format and normalised line endings. Version 1.1.0.0 followed on 26 November 2026 with external-change loading and optimisations for CODESYS Git 2.0. It requires CODESYS V3.5 SP22 or later and a Professional Developer Edition subscription. Without a licence, projects open read-only. CODESYS still recommends editing in the IDE, because only CODESYS decides whether a project is valid when it loads and builds. For headless builds, the CODESYS scripting engine runs Python scripts via CODESYS.exe --profile=... --runscript=... --noUI. For a feature comparison of the two main soft PLC stacks, see our CODESYS vs TwinCAT soft PLC comparison.

Beckhoff TwinCAT 3: XML per object

For plc version control, TwinCAT has been the most Git-friendly classic platform for years. Each POU, data type and global variable list is a separate XML file: .TcPOU, .TcDUT, .TcGVL, plus .TcTTO for tasks and .TcVis for visualisations. Project structure lives in .tsproj and .plcproj, with .xti files when multiple-file support splits I/O into separate files.

Beckhoff’s source-control documentation says to commit those, ignore .sln, .suo and .tpy, and treat .tmc as optional from TwinCAT 3.1 build 4018. It also says to resolve merge conflicts with the TwinCAT Project Compare tool rather than by hand. The XML is text, but it embeds structure such as LineIDs that a naive three-way merge can corrupt. Builds run through the TwinCAT Automation Interface, a COM API over the Visual Studio shell. TwinCAT Multiuser, available from build 4024, uses Git underneath and stores a repository on the target so commissioning changes are recorded automatically.

Rockwell Studio 5000: ACD, L5X and the Logix Designer SDK

Studio 5000 Logix Designer projects are binary .ACD files. The text form is L5X, an XML export of the full project or of components. Rockwell’s Logix Designer SDK guide (publication LDSDK-GR001) lists the relevant capabilities. It can open, save or export projects as ACD, L5K or L5X, and partially import and export routines, programs, UDTs, AOIs and rung groups as L5X. It can go online, change controller mode, and download to one or many controllers in parallel. Python is supported from SDK 2.01, and C# from SDK 2.00. Projects must be version 31 or later.

Two limits matter for plc version control and CI. The SDK guide does not describe a separate “build” operation, so verification comes from successful import, save and download to an emulated controller. And full-project L5X round-trip works, but L5X files are large and noisy, so you will want a normaliser before committing. Rockwell’s own SDK guide describes a Jenkins workflow that downloads to an emulated controller, writes and reads tags, and reports results. The cloud-based FactoryTalk Design Studio has built-in project history with commit, push, conflict resolution and restore, but Rockwell’s documentation does not say it uses Git.

Third-party layers

Copia Automation offers Git-based source control with rendered ladder, function block and structured text diffs, review workflows and its DeviceLink agent for backing up controllers and detecting changes. AUVESY-MDT octoplant focuses on scheduled upload, backup and compare across many vendors. These tools fill gaps the vendor tools leave, especially for drift detection and mixed-vendor plants. Evaluate them as part of the plc version control architecture, not as a replacement for a build pipeline.

Round-trip readiness at a glance

Platform Text format Round-trip from text Headless build path Unit test framework Container-friendly tests
TIA Portal V21.1 SimaticML XML, SIMATIC SD Improving; HW config new in V21.1, verify per project Openness .NET API TIA Portal Test Suite, PLCSIM Advanced No
Simatic AX Native .st + apax.yml Yes apax make / apax build AxUnit via apax test Yes, llvm target
CODESYS 3.5 SP22+ File-Based Storage text, JSON, XML Yes, with FBS and licence Scripting --runscript --noUI CODESYS Test Manager, CfUnit No
TwinCAT 3.1 .TcPOU and related XML Yes Automation Interface COM TcUnit No
Studio 5000 L5X XML Yes for full L5X Logix Designer SDK Emulated controller tests via SDK No

The table reflects documentation checked on 27 November 2026. “Verify per project” is deliberate: round-trip fidelity depends on which object types your project uses.

Walk-through: Branching, Testing and the Pipeline

With export paths understood, the next step is a plc git workflow that fits how machines are actually built, shipped and maintained.

A branching model for machines in the field

Web teams deploy one version to one production fleet. Machine builders ship one product baseline to dozens of machines, each with different options, I/O counts and site modifications. Many of those machines receive hotfixes from a field engineer at 2 a.m. with no network connection.

PLC git workflow branching model with main baseline, tagged releases, per-machine configuration overlays and field hotfix branches cherry-picked back to main

Figure 3: A branching model that separates the product baseline from per-machine configuration and gives field hotfixes a path back to main.

The model in Figure 3 has four rules. Keep main as the product baseline, protected and changed only by reviewed merge requests. Cut tagged releases from main, and never edit a tag. Represent each serial-numbered machine as configuration over a release, not as a long-lived fork of the code. Use a parameter file, a variant flag set, or a small machine-specific overlay directory. When a field change happens, upload the program from the controller, export it to text, and create a hotfix branch from the machine’s release tag. Diff it, review it, cherry-pick the fix into main, and retag the machine.

The overlay rule is what keeps plc version control sane across a fleet. If every machine is a branch, a fix to a common function block must be merged into fifty branches, and someone will miss one. If every machine is a release plus a configuration file, the fix lands once in main and flows to each machine at its next planned update.

Automated PLC testing that earns its keep

Unit tests are the next layer of plc version control, and they are still rare in PLC code, partly because the tooling arrived late. Three frameworks are now mature enough to anchor a pipeline. TcUnit is an MIT-licensed xUnit framework for TwinCAT. Its maintainer currently describes it as “stable but resting”, and the companion TcUnit-Runner for Jenkins is archived. AxUnit ships with Simatic AX. CODESYS Test Manager is part of the CODESYS Professional Developer Edition and supports CI integration and execution on target hardware.

A TcUnit test suite is a function block that extends TcUnit.FB_TestSuite. Each test is a method that brackets its assertions between TEST() and TEST_FINISHED(), which lets a test span several PLC cycles. Here is a test for a debounced fault latch:

FUNCTION_BLOCK FB_FaultLatch_Test EXTENDS TcUnit.FB_TestSuite
VAR
END_VAR
// Body: call each test method every cycle
LatchSetsOnPersistentFault();
ResetClearsLatch();

METHOD LatchSetsOnPersistentFault
VAR_INST
    fbLatch   : FB_FaultLatch;   // unit under test, debounce = T#50MS
    tWait     : TON;
END_VAR
TEST('LatchSetsOnPersistentFault');
fbLatch(bFault := TRUE, bReset := FALSE);
tWait(IN := TRUE, PT := T#100MS);
IF tWait.Q THEN
    AssertTrue(Condition := fbLatch.bLatched,
               Message   := 'Latch must set after fault persists past debounce');
    TEST_FINISHED();
END_IF

METHOD ResetClearsLatch
VAR_INST
    fbLatch : FB_FaultLatch;
END_VAR
TEST('ResetClearsLatch');
fbLatch(bFault := FALSE, bReset := TRUE);
AssertFalse(Condition := fbLatch.bLatched,
            Message   := 'Reset with no fault must clear the latch');
TEST_FINISHED();

A test program instantiates the suite and calls TcUnit.RUN() from a dedicated test task. The FB_FaultLatch interface and the VAR_INST timer layout are illustrative. The TcUnit calls, EXTENDS TcUnit.FB_TestSuite, TEST, AssertTrue, AssertFalse and TEST_FINISHED, follow the TcUnit user guide.

AxUnit uses a class-based style familiar to anyone who has used NUnit. Siemens’ own example repositories mark a class {TestFixture} and each test method {Test}:

USING AxUnit;

NAMESPACE Line3.Tests

    {TestFixture}
    CLASS TestFaultLatch
        VAR PROTECTED
            latch : FaultLatch;   // class under test
        END_VAR

        {Test}
        METHOD PUBLIC Reset_ClearsLatch_WhenNoFault
            latch.Evaluate(fault := FALSE, reset := TRUE);
            Assert.Equal(actual := latch.IsLatched(), expected := FALSE);
        END_METHOD

        {Test}
        METHOD PUBLIC Latch_Holds_AfterFaultClears
            latch.ForceLatched();
            latch.Evaluate(fault := FALSE, reset := FALSE);
            Assert.Equal(actual := latch.IsLatched(), expected := TRUE);
        END_METHOD
    END_CLASS

END_NAMESPACE

The FaultLatch class and its methods are illustrative. The {TestFixture}, {Test} and Assert.Equal(actual := ..., expected := ...) forms match Siemens’ published Simatic AX examples.

What should you test? Not every rung. Aim tests at the parts where regressions are expensive and logic is pure enough to isolate. Good targets are state machines, interlock and permissive logic, scaling and unit conversion, alarm debounce, recipe validation and communication message parsing. Physical I/O and timing-sensitive motion belong in simulation and virtual commissioning, not in unit tests.

Simulation in CI

Unit tests prove functions. Integration tests prove the program behaves as a system. S7-PLCSIM Advanced provides virtual S7-1500 and ET 200SP controllers with an API, documented by Siemens as C++ headers on its developer portal, for driving inputs and reading outputs. Rockwell’s Logix Designer SDK can download to an emulated controller and then read and write tags. Beckhoff and CODESYS can run their runtimes on the build host in simulation or usermode targets.

A practical CI integration test downloads the build, sets a known input pattern, cycles the program for a fixed number of scans, and asserts on outputs and internal tags. Push it further with a plant model, and you are into virtual commissioning. Our deep dive on virtual commissioning with software-in-the-loop and hardware-in-the-loop covers that layer. In plc version control pipelines, keep CI simulation runs short, under ten minutes as an engineering target, and push long plant-model runs to a nightly job.

A real pipeline: GitHub Actions for Simatic AX

Because Siemens publishes the AX actions, this workflow uses real action names and inputs. It runs in Siemens’ published CI container image on a hosted Linux runner.

name: ax-ci

on:
  pull_request:
    branches: [main]
  push:
    tags: ['v*']

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/simatic-ax/ci-images/apax-ci-image:4.4.0
    steps:
      - uses: actions/checkout@v4

      - name: Log in to apax registries
        uses: simatic-ax/actions/apax-login@v4
        with:
          apax-token: ${{ secrets.APAX_TOKEN }}

      - name: Install dependencies
        uses: simatic-ax/actions/apax-install@v4

      - name: Build with apax make (reads the project make.yml)
        uses: simatic-ax/actions/apax-make@v4

      - name: Unit tests on llvm target with coverage
        uses: simatic-ax/actions/apax-test@v4
        with:
          coverage: "true"
          log-level: "info"

      - name: Keep build output as evidence
        uses: actions/upload-artifact@v4
        with:
          name: ax-build-${{ github.sha }}
          path: out/

For validated plc version control, pin @v4 to an exact version such as @4.4.1 for validated systems, because Siemens’ actions README describes @v4 as a rolling major tag. Deployment to a real controller uses apax sld load with a target address, as shown in Siemens’ application-example manifests. Keep that step out of the pull-request pipeline and behind a manual approval.

A real pipeline: GitLab CI for TwinCAT, CODESYS or TIA Portal

The classic toolchains need a self-hosted Windows runner. The YAML below is valid GitLab CI syntax. The PowerShell scripts it calls are illustrative names for scripts you write against each vendor’s automation API.

stages: [lint, build, test, simulate, package, deploy]

default:
  tags: [windows, twincat-3.1.4026]   # licensed, pinned self-hosted runner

variables:
  GIT_DEPTH: "0"
  PROJECT_DIR: "plc/Line3"

lint:
  stage: lint
  script:
    - pwsh ci/check-normalised.ps1 -Path $PROJECT_DIR   # fail on GUID or timestamp-only churn
    - pwsh ci/static-rules.ps1 -Path $PROJECT_DIR       # naming and forbidden-instruction rules

build:
  stage: build
  script:
    - pwsh ci/build-twincat.ps1 -Solution "$PROJECT_DIR/Line3.sln" -Config Release
  artifacts:
    paths: [build/]
    expire_in: 30 days

unit-test:
  stage: test
  script:
    - pwsh ci/run-tcunit.ps1 -Build build/ -Out reports/junit.xml
  artifacts:
    when: always
    reports:
      junit: reports/junit.xml

simulate:
  stage: simulate
  script:
    - pwsh ci/sil-test.ps1 -Build build/ -Scenario ci/scenarios/smoke.yaml
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"

package:
  stage: package
  script:
    - pwsh ci/package-and-hash.ps1 -Build build/ -Out dist/   # writes SHA-256 and safety signature
  artifacts:
    paths: [dist/]
  rules:
    - if: $CI_COMMIT_TAG

deploy-site:
  stage: deploy
  environment: { name: "site-plant2-line3" }
  when: manual
  script:
    - pwsh ci/request-download.ps1 -Artifact dist/ -Target $LINE3_PLC
  rules:
    - if: $CI_COMMIT_TAG

Each ci/*.ps1 script is where the vendor specifics live. For TwinCAT it drives the Automation Interface. For CODESYS it calls CODESYS.exe --runscript --noUI with a Python build script. For TIA Portal it uses Openness. For Studio 5000 it calls the Logix Designer SDK. The junit report keyword is real GitLab syntax and gives you per-test results in the merge request.

Gates, change control and safety

A plc version control pipeline is not a continuous deployment pipeline. It is a continuous integration pipeline with a controlled, human-released deployment step.

PLC ci/cd change control sequence from engineer merge request through CI tests, change board approval, tagged release, site download and recorded deployment evidence

Figure 4: The change-control sequence around a PLC release. CI produces evidence; humans release; the site records what actually ran.

Figure 4 shows the order that matters. CI runs on every merge request and posts results, including any change in safety signature. A change board, or a named approver for small plants, approves the merge request together with a risk record. Only then does Git tag a release and CI publish a signed artifact. Site OT staff download during a maintenance window. The controller’s reported checksum is written back as deployment evidence against the tag.

For safety programs, plc version control needs hard rules. Fail the pipeline if the safety signature changes on a branch that is not labelled as a safety change. Require a second approver from the functional-safety role for those merges. Never automate a safety download. These rules match the intent of IEC 61508 change management; our IEC 61508 functional safety and safety PLC architecture guide covers the standard itself.

For cybersecurity, IEC 62443-4-1 defines eight secure development practices for product suppliers. Several map onto this pipeline. SM-6 covers file integrity, which signed artifacts and recorded hashes satisfy. SM-7 covers development environment security, which applies to your build runners and Git server. SVV-1 to SVV-5 cover security verification and validation testing. IEC 62443-2-4 sets requirements for service providers who integrate and maintain systems, which includes change and patch management. Our overview of IEC 62443 zones and conduits explains where the build infrastructure should sit relative to the control network. The short version: the CI server lives in an engineering zone, and only a controlled conduit reaches production controllers.

The audit trail you get for free

Once plc version control is in place, the audit trail assembles itself. The merge request holds the reviewer, the discussion and the approval. The pipeline log holds the toolchain version, test results and hashes. The tag holds the release. The deployment record holds the controller’s checksum and timestamp. A regulator or customer asking “what changed on Line 3 in March and who approved it” gets a link instead of a week of archaeology. For regulated industries this ties into formal change processes; see our article on engineering change management with ECR, ECO and ECN.

Trade-offs, Gotchas, and What Goes Wrong

Export-only text masquerading as source. The most dangerous plc version control failure is a team that commits text exports and assumes they can rebuild. Then a laptop dies, someone imports the text, and discovers missing hardware parameters or technology objects. Run the round-trip test in CI on a schedule. Import the committed text into a clean project, compile, and compare. If that job cannot exist for your platform yet, document that the binary is the master.

Merge conflicts in structured XML. TwinCAT, L5X and SimaticML are text, but they are text with structure. A Git auto-merge can produce XML that is well-formed yet semantically wrong, such as duplicated IDs or reordered networks. Use vendor compare tools as merge drivers where they exist. Otherwise make conflicts in these files block and require manual resolution in the IDE.

Licence and runner sprawl. Each IDE version, each hardware support package and each licence is a dependency of your plc version control pipeline. A plant with TIA Portal V17, V19 and V21 projects needs three runner images. Budget for this up front. It is usually the largest cost in a PLC CI/CD rollout, and it is easy to underestimate.

Online changes that never reach Git. Discipline alone does not fix this, and neither does plc version control by itself. Schedule controller uploads and compare them against the tagged release, using octoplant, Copia DeviceLink, TwinCAT Multiuser or a script on the Logix SDK. Alert on drift the same day, not at the next audit.

Over-testing the wrong things. Teams new to automated PLC testing sometimes write hundreds of tests that mock I/O and assert trivial assignments. Those tests break on every refactor and catch nothing. Test logic with decisions in it, and push timing and physics to simulation.

Unreviewed AI edits. Engineering agents and LLM code generators now write PLC code. They make review more valuable and more necessary. Our analysis of LLM-generated IEC 61131-3 code and safety verification explains why generated code must pass the same gates as human code, plus static checks for unsafe patterns.

Rolling tags in validated pipelines. actions/checkout@v4 and simatic-ax/actions/apax-test@v4 move over time. In GxP or safety contexts, pin exact versions or commit SHAs, and record them.

Practical Recommendations

Start plc version control with visibility, not automation. The first win from PLC version control is knowing what is on every controller and what changed. Get every project into Git as text, even if the binary stays the master, and add drift detection. That alone removes most “who changed this” incidents.

Then pick one platform with a strong round-trip path for plc version control and build a real pipeline there. Simatic AX and TwinCAT are the easiest starting points. CODESYS with File-Based Storage and Git 2.0 is now viable on SP22 and later. Studio 5000 works well through L5X and the Logix Designer SDK if you write a normaliser. For TIA Portal, V21.1’s extended Source Documents are the reason to re-evaluate this quarter. Test hardware-configuration round-trip on a real project before you depend on it.

Write unit tests for new code first, rather than retrofitting the whole library. Add a simulation smoke test once the build is stable. Keep deployment manual and gated. Make the safety signature a monitored pipeline output from day one.

Checklist:

  • [ ] Every PLC project exported to text and committed, with a .gitignore for generated files.
  • [ ] A normalisation step that strips timestamps and tool-version churn before commit.
  • [ ] A scheduled round-trip job: import text, compile, compare.
  • [ ] Pinned, self-hosted Windows runners per vendor and IDE version.
  • [ ] Protected main, reviewed merge requests, tagged releases, machine configuration as overlays.
  • [ ] Unit tests on state machines, interlocks and scaling; simulation smoke tests on merge requests.
  • [ ] Safety-signature change detection with a mandatory second approver.
  • [ ] Manual, approved deployment with checksum written back to the release.
  • [ ] Daily controller upload-and-compare with drift alerts.

Frequently Asked Questions

Can you use Git with TIA Portal?

Yes, TIA Portal Git workflows work, but not directly on the binary project. You export objects to text through the Version Control Interface workspace, TIA Portal Openness, or Simatic Source Documents, then put that folder under Git. TIA Portal V21.1, announced on 19 November 2026, extends Source Documents to hardware configuration, which closes a long-standing gap for round-trip workflows. Test the round trip on your own projects before treating Git as the source of truth, especially for safety programs and technology objects. A community VCI add-in can also automate commits from inside TIA Portal.

What is the best version control system for PLC programs?

Git is the de facto standard for plc version control, because it works with every CI server, review tool and hosting service. The real choice is the layer around it. Vendor-native options include CODESYS Git, TwinCAT Multiuser and TIA Portal VCI. Third-party platforms such as Copia Automation add rendered ladder diffs, and octoplant adds multi-vendor backup and drift detection. Many plants combine them: Git for engineering intent, plus a backup-and-compare tool to prove the running controller matches the released version.

How do you unit test PLC code?

Automated PLC testing uses an xUnit-style framework for your platform. TcUnit covers TwinCAT, AxUnit covers Simatic AX, and CODESYS Test Manager or the open-source CfUnit covers CODESYS. You write test suites as function blocks or classes, call the unit under test with known inputs, and assert on outputs. Focus on decision-heavy logic such as state machines, interlocks, scaling and alarm debounce. Leave physical I/O and motion timing to simulation, and export results in JUnit XML so your CI server can display them.

Is CI/CD safe for safety-rated PLC programs?

Continuous integration on top of plc version control is safe and helpful. Continuous deployment to safety controllers is not appropriate. Let the pipeline build, test and detect any change in the safety signature, such as the STEP 7 collective F-signature. Then require a functional-safety approver before release, and keep the download manual during a planned window. The pipeline should produce evidence for your IEC 61508 or IEC 62061 change process, not bypass it. Never let an automated job write to a safety program on a running machine.

Why are PLC project files hard to merge?

Most are binary containers, so Git cannot see inside them. Even text formats such as TwinCAT XML, L5X and SimaticML carry object IDs, ordering and metadata that a line-based merge can corrupt without causing a syntax error. Hardware configuration and safety parameters often sit in the same project as logic, so small changes ripple widely. The fix in a plc version control workflow is to normalise exports, keep changes small, and resolve conflicts in vendor compare tools rather than text editors.

Can PLC builds run in Docker containers?

Mostly not yet. TIA Portal, CODESYS, TwinCAT and Studio 5000 need a Windows host with the installed IDE and a licence to compile, so CI uses persistent self-hosted Windows runners. Simatic AX is the exception. Siemens publishes a CI container image and GitHub Actions that build and run AxUnit tests on an LLVM target without a PLC or PLCSIM. Plan your plc version control runner fleet around licences and IDE versions, and snapshot runner images so builds are reproducible.

Further Reading

By Riju — about

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *