CLion 2016.3 Help

Viewing Details of Changes

Apart from navigating through your local changes within a file in the editor, you can review these changes compared to the base revision of the file in question.

This functionality is provided through the dedicated Change Details pane in the Local Changes tab of the Version Control tool window:

To open the Change Details pane, open the Version Control tool window and switch to the Local Changes tab. Select a file you want to review and click the Preview Diff /help/img/idea/2016.3/previewUsages.png button on the toolbar.

The pane consists of two areas:

  • The affected code as it was in the base revision.
  • The affected code as it is after a change has been made.

To close the pane, click the Preview Diff button previewUsages once again.

The changes you introduce to the text are color-coded:

  • /help/img/idea/2016.3/lineAddedMarker.png line added.
  • /help/img/idea/2016.3/lineChangededMarker.png line changed.
  • /help/img/idea/2016.3/lineDeletedMarker.png line deleted.

Use the toolbar buttons and controls to navigate between changes and configure the appearance of the Change Details pane:

ItemTooltip and ShortcutDescription
/help/img/idea/2016.3/arrowUp.png/help/img/idea/2016.3/arrowDown.pngPrevious Difference / Next Difference Shift+F7 F7
Use these buttons to jump to the next/previous difference.

When the last/first difference is hit, CLion suggests to click the arrow buttons F7/Shift+F7 once more and compare other files, depending on the Go to the next file after reaching last change option in the Differences Viewer settings.

This behavior is supported only when the Differences Viewer is invoked from the Version Control tool window.

Compare Previous/Next File
Click these buttons to compare the local copy of the previous/next file with its update from the server.
/help/img/idea/2016.3/edit.png Jump to Source
Click this button to open the selected file in the active pane in the editor. The caret will be placed in the same position as in the Differences Viewer.
Viewer type
Use this drop-down list to choose the desired viewer type. The side-by-side viewer has two panels; the unified viewer has one panel only.

Both types of viewers enable you to

  • Edit code. Note that one can change text only in the right-hand part of the default viewer, or, in case of the unified viewer, in the lower ("after") line, i.e. in your local version of the file.
  • Perform the Apply/Append/Revert actions.
Use this drop-down list to define how the differences viewer should treat white spaces in the text.
  • Do not ignore: white spaces are important, and all differences are highlighted. This option is selected by default.
  • Trim whitespaces: ("\t", " ") , if they appear in the end and in the beginning of a line.
    • If two lines differ in trailing whitespaces only, these lines are considered equal.
    • If two lines are different, such trailing whitespaces are not highlighted in the By word mode.
  • Ignore whitespaces: white spaces are not important, regardless of their location in the source code.
  • Ignore whitespaces and empty lines: the following entities are ignored:
    • all whitespaces (as in the 'Ignore whitespaces' option)
    • all added or removed lines consisting of whitespaces only
    • all changes consisting of splitting or joining lines without changes to non-whitespace parts.
      For example, changing a b c to a \n b c is not highlighted in this mode.
Highlighting mode
Select the way differences granularity is highlighted.
The available options are:
  • Highlight words: the modified words are highlighted
  • Highlight lines: the modified lines are highlighted
  • Highlight split changes: if this option is selected, big changes are split into smaller 'atomic' changes.
    For example, A \n B vs. A X \n B X will be treated as two changes instead of one.
  • Do not highlight: if this option is selected, the differences are not highlighted at all. This option is intended for significantly modified files, where highlighting only introduces additional difficulties.
/help/img/idea/2016.3/collapseAll.png Collapse unchanged fragmentsClick this button to collapse all unchanged fragments in both files. The amount of non-collapsible unchanged lines is configurable in the Diff & Merge settings page.
/help/img/idea/2016.3/sync_scrolling.pngSynchronize scrollingClick this button to simultaneously scroll both differences panes; if this button is released, each of the panes can be scrolled independently.
/help/img/idea/2016.3/cogwheel_blue.pngEditor settingsClick this button to invoke the list of available settings. Select or clear this options to show or hide whitespaces, line numbers and indent guides, to use or disable the use of soft wraps, and to set the highlighting level.

These commands are also available from the context menu of the differences viewer gutter.

/help/img/idea/2016.3/external_tool.pngShow diff in external toolClick this button to invoke an external differences viewer, specified in the External Diff Tools settings page.

This button only appears on the toolbar when the Use external diff tool option is enabled in the External Diff Tools settings page.

Click this button to show the corresponding help page.
N/A Annotate

This option is only available from the context menu of the Change Details pane gutter.

Use this option to explore who introduced which changes to the repository version of the file in question, and when. The annotations view lets you see detailed information for each line of code, such as the version from which this line originated, the ID of the user who committed this line, and the commit date.

You can configure the amount of information displayed in the annotations pane.

For more details on annotations, refer to Working with Annotations

The most useful shortcuts in the Diff Pane are the following:

N/AUse this keyboard shortcut to show the popup menu of the most commonly user diff commands.
Ctrl+Tab Use this keyboard shortcut to switch between the left and the right panes.
Ctrl+Shift+Tab Use this keyboard shortcut to select the position obtained by Ctrl+Tab in the opposite pane.
Ctrl+Z/Ctrl+Shift+Z Use this keyboard shortcut to undo/redo a merge operation. Conflicts will be kept in sync with the text.

See Also

Last modified: 29 March 2017