CLion 2021.1 Help

Differences viewer for folders

Project tool window | context menu of a folder | Compare Directory with
Project tool window | context menu of two selected folders | Compare Directories
Project tool window | context menu of a folder | Sync with Deployed to
Remote Host tool window | context menu of a folder | Sync with local
Database tool window | context menu of two selected items | Compare

This window is displayed when you explore the differences between:

By using this dialog, you can explore differences and synchronize files between different folders.

Toolbar

IconTooltip and shortcutDescriptionAvailable for
Next PreviousF7 Shift+F7

Navigate between next and previous differences.

When the last or first difference is hit, CLion suggests to press F7/ Shift+F7 once more and compare other files.

Version control
Edit sourceJump to Source F4Open a file in the active tab of the editor. The caret is placed in the same position as in the Differences Viewer.All
RefreshRefresh F5Refresh the contents of the differences viewer.All
Show new files on left sideShow new files on left sideDisplay items that are present in the first of the compared directories or database objects and are missing in the second one in the left pane.All
Show diff in external toolShow diff in external tool

Invoke an external differences viewer. For more information about the external differences viewer, see the External Diff Tools page.

This button is only available if the Use external diff tool option is selected in the External Diff Tools settings page.

All
Show differenceShow differenceDisplay items that are present in both folders or database objects but have different contents, timestamp, or size.All
Show equal filesShow equal filesDisplay items that are present in both directories or objects and have the same contents, timestamp, and size, depending on the parameter set in Compare by list.All
Show new files on right sidShow new files on right sideShow the items that are present in the second of the compared directories and are missing in the first one. The same rule applies to database objects.All
Compare by

Applies the selected parameter for comparison. You can select between the following parameters:

  • Binary Content

  • Text (charset and line separators are ignored)

  • Size

  • Size and Timestamp

Local folders

Local-remote folders

Synchronize SelectedSynchronize Selected Enter

Apply the specified action to the selected pair of items.

In the * column of the table, you can see actions that are going to be performed.

All
Synchronize AllSynchronize All Ctrl+Enter

Apply the specified action to all the pairs of items in the list.

In the * column of the table, you can see actions that are going to be performed.

All
Hide excluded filesHide excluded filesHide files that are excluded from synchronization.Local-remote folders
Filter

Filter objects in comparing folders.

You can type a file or table name and filter all the objects according to this name. Use the asterisk wildcard (*) to replace any number of arbitrary characters.

Note that filter applies when you press Enter.

All
PathThese fields show the paths to the folders that are compared. To change a directory, click the Browse button (the Browse button) and specify another directory.

Local folders

Local-remote folders

helpHelp
F1
Open a browser and show the corresponding help page.All

Comparison table

The table lists the items that meet the comparison criterion specified in the Compare by list and the filtering criteria specified through the toolbar buttons.

ItemDescriptionAvailable for
NameThe column lists names of that belong to the object specified in theAll
SizeThe column lists file sizes.

Local folders

Local-remote folders

DateThe column lists file timestamps.

Local folders

Local-remote folders

*

The column lists actions that will be applied to the pair of items in one row.

  • Copy the item on the left side to the right side: copy the item on the left side to the right side. This action might overwrite the contents of the corresponding target item, if the target item already exists.

  • Copy the item on the right side to the left side: copy the item on the right side to the left side. This action might overwrite the contents of the corresponding target item, if the target item already exists.

  • The items are treated identical with regard to the selected criterion of comparison: items in both objects are treated identical with regard to the selected comparison options. No action is performed.

  • The items differ with regard to the selected criterion of comparison: the items differ according to the selected comparison options. No action is performed. You can explore the differences between objects in the Differences Pane and change the intended action by clicking its icon.

  • The item is present only in one of the folders and will be remove: the item exists only in one of the folders and will be removed.

Also, you can apply the action by clicking Synchronize Selected Synchronize Selected or Synchronize All Synchronize All toolbar buttons. The Synchronize Selected button applies operations only to the selected files. The Synchronize All button applies operations to all the files

To change the selected action, click the action icon in the * column.

All

Differences pane

The differences pane is displayed only for files that have the same names and exist in both folders. If a file or a database object exists only in one folder, the pane displays the contents of the selected file.

To switch between the panes of the differences viewer, press Ctrl+Tab. The active pane has the cursor.

Diff viewer

ItemTooltip and ShortcutDescription
the Previous Difference button/ the Next Difference buttonPrevious Difference / Next Difference Shift+F7 F7

Jump to the next or previous difference.

When the last or first difference is reached, 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 Commit tool window Alt+0.

the Back button
the Forward button
Compare Previous/Next File
Alt+LeftAlt+Right

Compare the local copy of the previous or next file with its update from the server.

the Go To Changed File buttonGo To Changed File Ctrl+NDisplay all the changed files in the current change set and navigate to them. This button is available only when you review changes in multiple files. For example, in the Local Changes view.
the Jump to Source buttonJump to Source
F4
Open the selected file in the active pane in the editor. The caret is placed in the same position as in the Differences Viewer.
Viewers

Select a viewer mode: side-by-side or unified. The side-by-side mode has two panels, the unified mode has one panel.

You can edit code and perform Apply, Append, Revert actions in both viewers.

You can change text only in the right-hand part of the side-by-side viewer, or in the lower line in the unified viewer.

You can edit only local versions of your files. You cannot edit files that have read-only status.

Whitespace

Define how the differences viewer should treat whitespaces.

  • Do not ignore: white spaces are important, and all the differences are highlighted. This option is selected by default.

  • Trim whitespaces: trim whitespaces if they appear in the end and at the beginning of a line (("\t", " ")).

    • If two lines differ in trailing whitespaces only, these lines are considered equal.

    • If two lines are different, 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: ignores 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, differences between a b c and a \n b c are not highlighted in this mode.

Highlighting mode

Select the way differences granularity is highlighted.

The available options are:

  • Highlight words: modified words are highlighted

  • Highlight lines: modified lines are highlighted

  • Highlight split changes: if this option is selected, big changes are split into smaller changes.

    For example, A \n B and A X \n B X are treated as two changes instead of one.

  • Highlight symbols: modified symbols are highlighted

  • Do not highlight: if this option is selected, the differences are not highlighted at all.

    Use the Do not highlight option when you work with the files that were significantly modified. In such cases, highlighting might introduce additional difficulties during a review.

the Collapse All buttonCollapse unchanged fragmentsCollapse all the unchanged fragments in both files. The amount of non-collapsible unchanged lines is configurable in the Diff & Merge settings page. To open the Diff & Merge page, open settings by pressing Ctrl+Alt+S and navigate to Tools | Diff & Merge.
the Synchronize buttonSynchronize scrollingClick this button to scroll both differences panes simultaneously. If this button is released, each of the panes can be scrolled independently.
the Settings buttonSettings

Open a list of available settings.

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

the External Tools iconShow diff in external tool

Invoke an external differences viewer specified on the External Diff Tools settings page.

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

helpHelp
F1
Open a browser and show the corresponding help page.
apply left apply right

Apply differences between panes (in case of the side-by-side viewer) or between lines (in case of the unified viewer).

The chevron buttons can change their behavior:

  • Click apply left and apply right to apply changes. This behavior is the default one.

  • Press Ctrl to change apply left or apply right to chevron button bottom right or chevron button bottom left and append changes.

Context menu

The context menu appears when you right-click an entry in the list of items. The commands in this menu define which action must be taken for the selected entry when you click Synchronize Selected or Synchronize All. The selected action appears in the * column.

CommandIconDescription
Set Copy to Right/LeftSet Copy to RightSet Copy to LeftCopy a file missing in one of the directories.
Set DeleteSet DeleteDelete a file.
Set Do NothingRemove an action icon.
Set Mirror to RightSet Mirror to RightMirror the contents of the left folder in the right folder when you click Synchronize All.
Set Mirror to LeftSet Mirror to LeftMirror the contents of the right folder in the left folder when you click Synchronize All.
Set DefaultSet the default action for the entry.
Warn When DeleteDisplay a warning before deleting a file that is located only in one of the two directories during their merge.

File comparison statuses and intended operations are shown in the column marked with an asterisk (*). To assign or change an operation, use the context menu associated with the corresponding cell. Alternatively, click the cell or press Space one or more times.

IconDescription
Copy the file to the right-hand folder

The file exists only in the left-hand folder. The intended operation is to copy the file to the right-hand folder.

If a file exists in both folders and you apply this operation, the file in the right-hand folder is overwritten.

Files are not identical

For the selected comparison criterion, the files are not identical. No operation is assumed.

Study the file differences in the lower part of the view. You can choose to overwrite one of the files by assigning and applying the corresponding operation. You can as well modify the file contents.

This may be done by typing or by using the following buttons and context menu commands:

  • the Arrow Right icon or the Arrow Left icon or Replace. Replace the fragment with the one from the other pane.

  • the Arrow Right Down icon or the Arrow Left Down icon or Insert. Insert the fragment into the other pane.

  • Remove. Remove the corresponding fragment.

To undo the changes, use Ctrl+Z.

Files are identicalFor the selected comparison criterion, the files are identical. No operation is assumed.
File exists only in the right-hand folder

The file exists only in the right-hand folder. The intended operation is to copy the file to the left-hand folder.

If a file exists in both folders and you apply this operation, the file in the left-hand folder is overwritten.

Delete a fileDelete the file. The operation is not available for files that exist in both folders.
Last modified: 09 July 2021