JetBrains Space Help

Compare Revisions

You can see how a certain commit changed the repository code base, what files were affected and what was changed in each of them.

  1. Navigate to the project and open the repository.

  2. On the sidebar, choose Commits to see the revision list.

  3. Scroll down the list to locate the revsion you want to check, or find it using the search.

  4. Click the revision entry — all the files affected by this commit will be listed in the right pane:

    commitsViewFiles.png

    The list may contain files that were:

    • file-modified.png Modified

    • file-added.png Added

    • file-deleted.png Deleted

    • file-renamed.png Renamed

  5. Now you can see what changes were made in each file. Click the file to display its inline diff and compare its two revisions:

    commitsViewFileDiff.png

Unified (inline) diff

The unified diff shows you the differences line-by-line:

inlineDiff.png

The deleted fragments are highlighted in red, the added ones are in green, and the modified ones are in grey.

Unchanged blocks of code are hidden. You can reveal them by clicking on the cut lines:

inlineDiffCutLines.png

From the unified diff view you can:

  • Go to a split (side-by-side) diff.

  • View comments (if any).

  • Go to the editor and edit this file (if you have a permission): edit.png

  • View the next or previous file in the change set: just scroll the panel up or down.

  • Hide the diff view: close-view.png

unifiedDiffOptions.png

Split (side-by-side) diff

The split diff view displays different versions of the file — the older one and the newer one — together on one screen. You can inspect the entire content of both versions and compare the differences line-by-line.

side-by-side-Diff.png

The deleted fragments are highlighted in red, the added ones are in green, and the modified ones are in grey.

Merge commit diffs

When comparing versions of a file included in a merge commit, you might notice that the diff is blank. This is perfectly normal for a file that has not been modified in both branches before the merge. Since merging doesn't usually involve intersecting changes or conflicts, the diffs will be empty most of the time.

The diff will display changes only if the merge commit contains a file that is changed relative to both parents (its versions from both branches).

Example:

  1. Let's say there is a branch Branch A with a file somefile.txt that contains the following lines:

    mergeDiffExample-1.png
  2. Create a branch Branch B off Branch A and change the file (the third line) in Branch B:

    mergeDiffExample-2.png
  3. In Branch A, make some other change to the file (the first line):

    mergeDiffExample-3.png
  4. Merge Branch B into Branch A.

    The resulting version of the file will include changes from both branches.

  5. Now you can navigate to the merge commit in Space and open the diff:

    mergeDiffExample-4.png

    We can see the diff because the final version of somefile.txt is different from its both parent versions: Branch A and Branch B.

Last modified: 10 November 2020