CLion 2019.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:

This dialog lets you explore the differences and synchronize the folders you are comparing.

Toolbar

Item

Tooltip and shortcut

Description

Available for

Next Previous F7
Shift+F7

Use these buttons to jump to the next/previous difference.

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

Version control

Edit source

Jump to Source
F4

Click this button to open file in the editor's active tab. The caret will be placed in the same position as in the Differences Viewer.

All

Refresh

Refresh
F5

Click this button to refresh the contents of the differences viewer.

All

Show new files on left side

Show new files on left side

Click this button to display 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 tool

Show diff in external tool

Click this button to invoke an external differences viewer, specified in 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 difference

Show difference

Click this button to display items that are present in both folders or database objects but have different contents, timestamp, or size.

All

Show equal files

Show equal files

Click this button to display 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 sid

Show new files on right side

Press this toggle button to have CLion show the items, that are present in the second of the compared directories or database objects and are missing in the first one.

All

Compare by

From this list, select the parameter to be used for comparison. The available options are:

  • Binary Content
  • Text (charset and line separators are ignored)

  • Size
  • Size and Timestamp

Local folders
Local-remote folders

Synchronize Selected

Synchronize Selected
Enter

Click this button to have CLion apply the specified action to the selected pair of items. Actions to be performed are shown in the * field.

All

Synchronize All

Synchronize All
Ctrl+Enter

Click this button to have CLion apply the specified action to all the pairs of items in the list. Actions to be performed are shown in the * field.

All

Hide excluded files

Hide excluded files

Click this button to suppress showing files excluded from synchronization.

Local-remote folders

Filter

Type the filtering string (for example, file or table name). Use * wildcard to replace any number of arbitrary characters.

Note that filter applies on pressing Enter.

All

Path

These fields show the paths to the folders being compared. To change a directory, click Browse Browse and specify another directory in the dialog that opens.

Local folders
Local-remote folders

View reference

Help
F1

Click this button to show reference page.

All

List of items

The list shows the items from the compared objects that meet the comparison criterion specified in the Compare by list and the filtering criteria specified through the toolbar buttons.

Item

Description

Available for

Name

These read-only fields show the names of    under the object specified in the    fields.

All

Size

These read-only fields show the sizes of files under the folders being compared.

Local folders
Local-remote folders

Date

These read-only fields show the timestamps of files under the folders being compared.

Local folders
Local-remote folders

*

The icon in this field indicates the action that will be applied to the pair of items in the current line upon clicking the Synchronize Selected Synchronize Selected  or Synchronize All Synchronize All  toolbar button.

To change the currently selected action, click the icon.

Icon

Action

Copy the item in the left side to the right side

Copy the item in the left side to the right side, possibly overwriting the contents of the corresponding target item, if it already exists.

Copy the item in the right side to the left side

Copy the item in the right side to the left side, possibly overwriting the contents of the corresponding target item, if it already exists.

The items are treated identical with regard to the selected criterion of comparison

The items are treated identical with regard to the selected criterion of comparison. No action will be performed by default.

The items differ with regard to the selected criterion of comparison

The items differ with regard to the selected criterion of comparison. No action will be performed by default. Explore the differences in the Differences Pane and change the intended action by clicking the icon.

The item is present only in one of the folders and will be remove

The item is present only in one of the folders and will be removed.

All

Differences pane

The differences pane is displayed only for files  with the same names, which exist on both sides. For the files and DB objects that exist on one side only, the contents of the selected file/DB object is displayed.

If the files have read-only status, they are not editable in the differences pane.

Diff viewer

Item

Tooltip and Shortcut

Description

the Previous Difference button/the Next Difference button

Previous Difference / Next Difference Shift+F7 F7

Use these buttons to jump to the next/previous difference.

When the last/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 Version Control tool window.

the Back button
the Forward button

Compare Previous/Next File
Alt+LeftAlt+Right

Click these buttons to compare the local copy of the previous/next file with its update from the server.

the Go To Changed File button

Go To Changed File Ctrl+N

Click this button to display all changed files in the current change set (and navigate to them). This button only appears when you are reviewing changes in multiple files (for example, in the Local Changes view of the VCS log.

the Edit button

Jump to Source
F4

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 list to choose a 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, that is in your local version of the file.

  • Perform the Apply/Append/Revert actions.

Whitespace

Use this list to define how the differences viewer should treat whitespaces.

  • 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.

  • Highlight symbols: the modified symbols will be highlighted

  • 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.

the Collapse All button

Collapse unchanged fragments

Click 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.

the Synchronize button

Synchronize scrolling

Click this button to simultaneously scroll both differences panes; if this button is released, each of the panes can be scrolled independently.

the Settings button

Settings

Click this button to invoke the list of available settings. Select or clear these 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.

Include into commit Alt+I

This checkbox only appears if you invoke the Differences Viewer from the Commit Changes dialog with multiple changed files (all of which are deselected), and you explore the differences between them and hit the last difference in a file.

Select this checkbox if you want to include the file you've reviewed into the commit.

the Move to Another Changelist button

Move to Another Changelist F6

This button only appears if you invoke the Differences Viewer from the Commit Changes dialog with multiple changed files (all of which are deselected), and you explore the differences between them and reach the last difference in a file.

Click this icon to move the file you've reviewed to another changelist.

the External Tools icon

Show diff in external tool

Click 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.

the Help button

Help
F1

Click this button to show the corresponding help page.

Ctrl+Tab

Use this keyboard shortcut to switch between the panes of the Differences viewer. The active pane has the cursor.

the chevron iconthe chevron icon

Use these chevron buttons to 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 the chevron iconthe chevron icon to apply changes. This behavior is the default one.

  • Press Ctrl to change the chevron icon the chevron icon to the chevron icon or the chevron icon and append changes.

Context menu

This 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 on clicking Synchronize Selected or Synchronize All. The selected action appears in the * column.

Item

Icon

Description

Set Copy to Right/Left

Set Copy to Right
Set Copy to Left

This command sets the specified icons in the * column to copy a file missing from one of the directories. If a file exists on one side, it will be copied; if it doesn't exist, then the file on the other side will not be deleted.

Set Delete

Set Delete

This command sets the specified icons in the * column to delete file.

Set Do Nothing

Choose this command to remove an action icon.

Set Mirror to Right

Set Mirror to Right

Choose this command to automatically set actions in the * column that will mirror the contents of the left folder in the right folder when you click Synchronize All.

Set Mirror to Left

Set Mirror to Left

Choose this command to automatically set actions in the * column that will mirror the contents of the right folder in the left folder when you click Synchronize All.

Set Default

Choose this command to set the default action for the entry.

Warn When Delete

Select this option to display a warning when trying to delete a file that is located only in one of the two directories during their merge.

Compare folders

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.

Applying operations:

  • the Synchronize Selected button (Enter) applies the operations to selected files.

  • the Synchronize All button (Ctrl+Enter) applies the operations to all the files.

Icon

Description

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 iconor 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 identical

For 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 file

Delete the file. The operation is not available for files that exist in both folders.

Last modified: 2 July 2019

See Also