---
title: "Review changes"
---

# Review changes

Review a change to a TwinCAT object part by part as Structured Text against Git, with metadata-only changes labelled and collapsed.

A TwinCAT object file is XML with Structured Text inside it, so a plain Git diff shows XML noise around the code that changed. The PLC module compares an object part by part instead, so a reviewer sees the declarations and bodies that changed.

**State:** modelled for the TwinCAT per-object compare, on the TwinCAT object files held as test fixtures. The commands have not been run in the Editor against the real Git extension and a real repository.

## Compare a TwinCAT object with Git

The commands work on `.TcPOU`, `.TcGVL`, `.TcDUT` and `.TcIO` files:

- **Compare TwinCAT Object with HEAD** compares with the last commit, read through the Git extension.
- **Compare TwinCAT Object with Source Control Original (Git: Staged)** compares with what the Source Control gutter compares against: for Git, the staged version.

Run them from the Explorer's context menu on the file, the Source Control view's resource menu, or the Command Palette. They open a multi-file diff editor with one entry per changed part.

1. Work on a copy of the project under Git.
2. Change the object: in the text editor, the declaration table or a diagram.
3. Right-click the file in the Explorer and run **Compare TwinCAT Object with HEAD**.
4. Read one entry per changed part: the object itself and each method, property (with its Get and Set), action and transition. Each part shows its declaration and its body side by side, coloured as Structured Text.

What the compare does:

- Parts are paired by GUID first, then by kind and name, so a renamed method shows as renamed, not as removed and added.
- XML changes that are not Structured Text are named as such: a GUID, an attribute such as FolderPath, ObjectProperties, the object kind, the TcPlcObject version.
- Changes that are only metadata (LineIds, attribute or member order, XML layout) are listed, labelled and collapsed, so they do not hide real changes.
- Two different texts are never reported as identical.

## Why the diffs stay small

The project edits of the module change only the lines they touch: a declaration or body change writes only the lines that differ, in the file's own line breaks, and keeps the GUIDs of the object and its members. Renaming every object file of the test fixtures to another name and back restores each byte for byte. A reviewer therefore sees the change that was asked for, not a reformatted file. See [Add, rename, move and remove objects](https://neuralinverse.com/docs/modules/plc/project-objects/).

## Graphical bodies and rungs

A graphical body (LD, FBD, SFC, CFC) is labelled as not Structured Text in the compare; this path is covered by code only, since none of the compare fixtures holds one. To review a change to a ladder network today, open both versions as [diagrams](https://neuralinverse.com/docs/modules/plc/diagrams/) (**Open as Diagram**), or review the operands and expressions, which are Structured Text regions of the file and are checked as you edit.

## Everything else

Use the Editor's standard Source Control view for staging, commits, branches and pull requests. Project files (`.tsproj`, `.plcproj`) are compared as text. Rung diff, merge help, vendor multiuser and compare for CODESYS and TIA Portal objects are on [What's next](https://neuralinverse.com/docs/modules/plc/whats-next/).
