Git
Tech Tips
Product Features

A Closer Look at Diffs

Published on
November 23, 2022

New users to Git-based version control may quickly grasp enough to get started and be up-and-running in a matter of minutes, and be contributing new changes to the codebase within a day. 

As these users get more comfortable with Git, it’s useful to dig a little deeper to leverage the maximum benefit possible from the tools at their disposal.  Let’s take a closer look at one of those fundamental tools of Copia’s Git-based source control, Diffs.

The Basics

A Diff is a comparison between two commits, or project snapshots.  A Diff contains concise information about what exactly is different between the two versions.  Traditionally, a Diff is purely text-based, and can only be effectively leveraged for text-based files.  

A Git Diff of a Python file

Copia developed Visual Diffs, or VisDiffs, to overcome this limitation for PLC code.  With VisDiffs, Copia’s Git-based source control makes it easy to see what changed from one version to the next, just by clicking on a commit, either in Copia’s Desktop App, or in a web browser, on Copia’s Web App.

View Options

When viewing a Diff in Copia, it’s usually most helpful to view only the parts of the PLC code which have changed. By default, Copia hides things that haven’t changed, but it’s easy to show unchanged elements with the View Options dropdown menus.

A Commit in Copia’s Desktop App showing both the Project Tree View Options (center) and Render Pane View Options (right)

Digging Deeper

Along with giving the ability to easily see what changed in a single commit, Copia also allows users to compare non-sequential commits, with just a couple extra clicks.

By selecting Compare Commits (outlined in red), users can select any two commits to compare them, as shown

This makes it easy to see changes in bulk, allowing users to compare, for example, the current version of development code to the last major release version. 

This ability extends further, and allows users to even compare commits across different branches, allowing users to easily compare any two versions of a PLC project, even, for example, two coexisting, current versions of a PLC project undergoing parallel or multi-user development.

Selecting a branch to compare (outlined in red) allows users to easily compare commits across branches; shown is a comparison between v1.1 on the main branch, and the most recent commit on the factory-testing branch.

With Copia’s VisDiffs, and the many tools made available for interacting with them, it’s quick and easy to compare any historical or current development versions against one another, or against a device backup captured with Copia’s DeviceLink™.  To see these tools in action for yourself, start your free trial at copia.io/trial