The Diff That
Understands Your Code

SemanticDiff helps you review code diffs faster. It hides irrelevant changes, detects moved code, and understands refactorings.

Move code in SemanticDiff Move code in SemanticDiff - highlighted Style changes are hidden in SemanticDiff Style changes are hidden in SemanticDiff - highlighted SemanticDiff highlights refactorings SemanticDiff highlights refactorings - example 1 SemanticDiff highlights refactorings - example 2 Move code in SemanticDiff

Supports 9+ programming languages and data exchange formats:

Go
JavaScript
TypeScript
Python
C#
Java
CSS
SCSS
JSON
Online Demo

Try It Now!

You can try a subset of SemanticDiff’s features directly in your browser.
Go ahead and select one of the examples or enter your own code.

What is SemanticDiff?

Language Aware Diff For VS Code & GitHub

SemanticDiff is a programming language aware diff that distinguishes between relevant and irrelevant changes. Irrelevant changes such as added/removed whitespace, optional commas or unnecessary parentheses are hidden to help you focus on the actual changes. Relevant changes are further analyzed to highlight moved code, renames or other refactorings. This helps you understand code changes faster, especially when working with reformatted or refactored code.

Hides Style Changes
Style changes are hidden in SemanticDiff
Hides Style Changes

Why spend time on reviewing the output of your code formatter? Let the CI validate the code style, while you concentrate on the logic changes.

  • Spot changes within reformated code
  • Skip manual review of style changes
  • Focus on changes to the program logic

Not convinced? Compare GitHub with SemanticDiff.

Detects Moved Code
SemanticDiff detects how code was moved
Detects Moved Code

When moving a lot of code, it is easy to overlook that print statement you added while debugging. It is buried in a huge hunk of red and green lines. Wouldn’t it be great if your diff tool would highlight such modifications?

  • See how code was moved within or across files
  • Spot changes within moved code

See it live in action.

Understands Refactorings
SemanticDiff highlights refactorings
Understands Refactorings

Refactorings are often simple but can affect many lines of code. Checking all the individual changes is often too tedious so that other unintended changes get overlooked. SemanticDiff assists you by automatically separating refactorings from other code changes.

  • See which changes belong to the same refactoring
  • Selectively hide certain or all refactorings
  • Divide and conquer your diff

Newsletter

Interested in new features and releases?
Enter your email to stay up to date.

Something went wrong

Thank You For Your Interest

To complete your registration, click on the link in the email we sent you. If you are already registered, no email will be sent.

FAQ

Learn more about SemanticDiff.

A code diff is a visual representation of how source code files have changed between two (or more) versions of a software. There are a few different variants, but most of them are based on a line-by-line comparison of the source code files. Added lines are marked in green, deleted lines are marked in red. Diff tools are part of every version control system, with git diff and the GNU diffutils being the most popular ones.

Common diffs treat source code as text files, and generate a visualization based on a simple line-by-line comparison. This is far from perfect: There are many types of code changes, such as inserting line breaks between function arguments, that don’t have any effect on the software but are displayed as changes. This adds a lot of visual noise and makes it difficult for developers to spot the relevant changes.

In contrary, a semantic diff (or also called structural diff) understands the meaning of the change. It can, for example, distinguish between relevant and irrelevant changes, and recognizes when changes correspond to a typical refactoring pattern, like moving code or renaming a function. Instead of showing lot of changed lines, a semantic diff will show an abstract description of the change, e.g., that a function has been renamed.

SemanticDiff works similar to a compiler or interpreter. Given two source codes to compare, they are first converted to Abstract Syntax Trees (ASTs). This step adds additional information that enables us to filter out various style changes, like adding optional semicolons or commas in an array initialization.

In a second step, we match both trees to find out what has changed. Additional rules are applied to filter out more complex invariances. Afterwards the detected changes are translated back into a text diff representation.

The SemanticDiff beta supports most programming languages relevant for web development. We plan to add more languages based on the user feedback we receive. The currently supported programming languages and data exchange formats are:

  • C#
  • CSS / SCSS
  • Go
  • Java
  • JavaScript / JSX
  • JSON
  • PO (gettext)
  • Python
  • TypeScript / TSX

Our long-term goal is to make SemanticDiff available wherever you need it. For now, we’re focusing on one product, our VS Code Extension, to iterate quickly. However, we are open to third-parties integrating our technology into their software. If this sound interesting to you, get in touch with us.

Yes. If you want to review a public GitHub pull request you can simply open our GitHub App and enter the URL of the PR.

The second option is to use our Visual Studio Code extension to review merge requests. Simply open the corresponding code diff, either by using the VS Code extension provided by your Git hoster or by checking out the code locally and manually opening the diff in VS Code. Then switch to SemanticDiff by clicking on our logo in the top right corner. Please note that not all features, such as adding comments, may be available in the SemanticDiff view.

SemanticDiff is able to detect moved or copied blocks of code, as well as renaming of variables, functions, and classes. Additional types of refactorings will be added over time. If you have suggestions on what should be recognized, feel free to open a feature request in our bug tracker.

Please note that not all of these features may be available in the beta version yet.

There are very few other tools that can generate structural/semantic diffs. The ones we know of focus on supporting a wide variety of programming languages at the expense of accuracy and not supporting advanced features.

In contrast, our goal is to develop software that delivers correct results that developers can rely on. This is also an important requirement for advanced features, like detecting refactorings. We therefore support only a small number of programming languages at the moment, for which we want to improve support together with our beta testers.

Want To Know More? Get In Touch!

Do not hesitate to contact us if you have any questions or feedback.
We look forward to hearing from you.