GoLand 2018.3 Help

Review Changes

This topic explains how to keep track of the changes that you and your teammates introduce to the source code.

Review project history

GoLand allows you to review all changes made to the project sources that match the specified filters.

For distributed version control systems, such as Git and Mercurial, you can view project history in the Log tab of the Version Control tool window (see Investigate changes.

For centralised version control systems, such as Subversion, Perforce, CVS, ClearCase, and TFS, project history is available in the Repository tab of the Version Control tool window.

Tracking changes to a file in the editor

As you modify a file that is under version control, all changes are highlighted in the editor with change markers that appear in the left gutter next to the modified lines and show the type of changes introduced since the last synchronization with the repository. When you commit the modified file to the repository, the change markers disappear.

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

  • lineAddedMarker line added.

  • lineChangededMarker line changed.

When you delete a line, the following marker appears in the left gutter: deleted line marker.

You can manage changes using the dedicated toolbar. To invoke it, hover the mouse cursor over a change marker and then click it. The toolbar is displayed together with a frame showing the previous contents of the modified line:

change marker toolbar

The actions in the toolbar let you navigate to the next or previous change, rollback a change, view the differences between the current and the repository version, copy the previous version of the modified line to Clipboard, or turn on highlighting differences in the code.

If you want to turn off highlighting changes, in the Settings/Preferences dialog (Ctrl+Alt+S) select Editor | General on the left, and uncheck the Highlight modified lines in gutter option.

Comparing local changes with the repository version

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.

You can review changes in one of the following ways:

  • Preview changes in the Local Changes view: select a file and click the Preview Diff button preview details on the toolbar.

  • Explore changes in the Differences Viewer: select a file and press Ctrl+D or click show diff on the toolbar.

The left pane shows the affected code as it was in the base revision, and the right page shows the affected code after changes have been made.

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

Item

Tooltip and Shortcut

Description

icons actions previousOccurence svg/icons actions nextOccurence svg

Previous Difference / Next Difference Shift+F7 F7

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

When the last/first difference is hit, GoLand 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.

icons actions edit svg

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.

icons actions back svg
icons actions forward svg

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.

icons actions listFiles svg

Go To Changed File Ctrl+N

Click this button to display all changed files in a current change set (and navigate to them).

Viewer type

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

Whitespace

Whitespace list

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

Highlighting mode list

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.

icons actions collapseall svg

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.

icons actions synchronizeScrolling svg

Synchronize scrolling

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

icons general gearPlain svg

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

icons general externalToolsSmall

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.

icon help

Help
F1

Click this button to show the corresponding help page.

N/A

Annotate

This option is only available from the context menu of the 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.

For more details on annotations, refer to Using annotations

The most useful shortcuts are the following:

Shortcut

Description

Use this keyboard shortcut to show the popup menu of the most commonly used 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.

Viewing changes history for a file or selection

GoLand allows you to review changes made to files or even fragments of source code. The Show History and the Show History for Selection commands are available from the main VCS menu and from the context menu of files.

The change history for a file is displayed in the dedicated History tab of the Version Control tool window.

The change history for a selection of code is displayed in a separate window, in the form of the differences viewer.

View the history for a file

  • Open a file in the editor or select in the Project tool window and choose <VCS> | Show History from the context menu.

The History tab for the selected file appears in the Version Control tool window, the name of the file is shown on the title bar of the tab.

You can use the toolbar buttons to compare the selected revision with the local version, compare classes from the selected revision, checkout the selected revision from your VCS, annotate the selected revision, etc.:

Item

Tooltip and Shortcut

Description

icons actions refresh svg

Refresh

Click this button to refresh the current information.

icons actions diff svg

Show Diff
Ctrl+D

Click this button to compare the selected revision of a file with its previous revision in the Differences Viewer.

icons actions listChanges svg

Show All Affected Files
Shift+Alt+A

Click this button to open the Paths Affected in Revision dialog where you can view all files that were modified in the selected revision.

icons vcs branch svg

Show All Branches

Click this button to display changes from branches other than the current one.

icons actions previewDetailsVertically svg

Show Details

Click this button to show the commit message for the selected revision.

icons vcs vendors github svg

Open in GitHub

Click this button to open the page that corresponds to the selected commit on GitHub.

Viewing the History for a Selection

  1. In the editor, select a fragment of the source code.

  2. Choose <VCS> | Show History for Selection from the main VCS menu, or on the context menu of the selection.

The history for the selected fragment will open in a separate window.

Checking file status

GoLand allows you to check the status of project files relative to the repository. File status shows you which operations have been performed on the file in question since you last synchronized with the repository.

You can check the status of a file in any interface element (e.g. the editor, or various tool windows) by the color used to highlight the file name.

Color

File Status

Description

Color sample: dark green #0A7700

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: green #0EAA00

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: red #FF0000

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings/Preferences | Version Control | Changelists.

Color sample: dark green #0A7700

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: grey #616161

Deleted

The file is scheduled for deletion from the repository.

Color sample: dull purple #773895

Deleted from file system

The file has been deleted locally, but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: light grayish blue #8AA4C8

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: bright blue #3264B4

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: light brown #B28C00

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: dark olive #727238

Ignored

A file is intentionally untracked by VCS.

Color sample: purple #7503DC

Merged

The file is merged by your VCS as a result of an update.

Color sample: red #FF0000

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: red #FF0000

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: red #FF0000

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: bright navy #0032A0

Modified

The file has changed since the last synchronization.

Color sample: blue #0047E4

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: Olive #7C7C00

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: teal #007C7C

Renamed

Since the last update, the file has been renamed.

Color sample: dark cyan #08978F

Switched

[CVS, SVN] The file is taken from a different branch than the whole project.

Color sample: brown #993300

(Unknown) Unversioned

The file exists locally, but is not in the repository, and is not scheduled for addition.

Color sample: black None (default color)

Up to date

The file hasn't been changed.

Color

File Status

Description

Color sample: dull green #629755

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: dull green #629755

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: dull red #D5756C

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings/Preferences | Version Control | Changelists.

Color sample: green #0A7700

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: grey #6C6C6C

Deleted

The file is scheduled for deletion from the repository.

Color sample: dull purple #6C6C6C

Deleted from file system

The file has been deleted locally, but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: light blue #6897BB

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: light blue #6897BB

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: white None (default color)

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: light olive #848504

Ignored

A file is intentionally untracked by VCS.

Color sample: light purple #9876AA

Merged

The file is merged by your VCS as a result of an update.

Color sample: dull red #D5756C

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: dull red #D5756C

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: dull red #D5756C

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: light blue #6897BB

Modified

The file has changed since the last synchronization.

Color sample: light blue #6897BB

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: white None (default color)

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: strong cyan #3A8484

Renamed

Since the last update, the file has been renamed.

Color sample: white None (default color)

Switched

[CVS, SVN] The file is taken from a different branch than the whole project.

Color sample: soft red #D1675A

(Unknown) Unversioned

The file exists locally, but is not in the repository, and is not scheduled for addition.

Color sample: white None (default color)

Up to date

The file hasn't been changed.

Color

File Status

Description

Color sample: green #62CC47

Added

The file in the active changelist is scheduled for addition to the repository.

Color sample: green #62CC47

Added in not active changelist

The file in an inactive changelist is scheduled for addition to the repository. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: dull red #FF6666

Changelist conflict

The file in an inactive changelist has been modified in the active changelist. In this case, a new dialog will open prompting you to resolve the changelist conflict. This file status is available if all options are enabled in Settings/Preferences | Version Control | Changelists.

Color sample: green #62CC47

Copied

If a file is a copy of another file, its metadata is tracked, and such a file is marked as copied.

Color sample: orange #ED864A

Deleted

The file is scheduled for deletion from the repository.

Color sample: orange #ED864A

Deleted from file system

The file has been deleted locally, but hasn't been scheduled for deletion, and it still exists in the repository.

Color sample: vivid cyan #4FF0FF

Have changed descendants

If a file is modified, the IDE will recursively highlight all directories containing that file. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: vivid cyan #4FF0FF

Have immediate changed children

If a file is modified, the IDE will highlight its parent directory. This status is available if the Show directories with changed descendants option is enabled in Settings/Preferences | Version Control.

Color sample: white None (default color)

Hijacked

[Perforce, ClearCase, VSS] The file is modified without checkout.

Color sample: light olive #A9B837

Ignored

A file is intentionally untracked by VCS.

Color sample: light purple #ED94FF

Merged

The file is merged by your VCS as a result of an update.

Color sample: dull red #FF6666

Merged with conflicts

During the last update, the file has been merged with conflicts.

Color sample: dull red #FF6666

Merged with property conflicts

During the last update, the IDE has detected differences between the properties of the local file and its server version.

Color sample: dull red #FF6666

Merged with text and property conflicts

Text and property conflicts happen when two or more developers modify the same lines of a file and the same file properties.

Color sample: vivid cyan #4FF0FF

Modified

The file has changed since the last synchronization.

Color sample: vivid cyan #4FF0FF

Modified in not active changelist

The file in an inactive changelist has been modified. This file status is available if the Highlight files from non-active changelists option is enabled in Settings/Preferences | Version Control | Changelists.

Color sample: white None (default color)

Obsolete

The file should no longer be in your working copy of the repository.

Color sample: vivid cyan #4FF0FF

Renamed

Since the last update, the file has been renamed.

Color sample: white None (default color)

Switched

[CVS, SVN] The file is taken from a different branch than the whole project.

Color sample: soft red D1675A

(Unknown) Unversioned

The file exists locally, but is not in the repository, and is not scheduled for addition.

Color sample: white None (default color)

Up to date

The file hasn't been changed.

Using annotations

What are VCS annotations?

Annotation is a form of file presentation that shows detailed information for each line of code. In particular, for each line you can see the version from which this line originated, the user ID of the person who committed this line, and the commit date. The annotated view helps you find out who did what and when, and trace back the changes.

Annotating lines of code is available for ClearCase, TFS, Mercurial, Git, CVS, Perforce and Subversion.

The Annotate command is available from VCS-specific nodes of the Version Control menu, the context menu of the Editor left gutter, file context menus, and the file history view.

When annotations are enabled, the left gutter looks similar to the following example:

annotate

Annotation options

  • Configure the amount of information displayed in annotations: right-click the annotations gutter and select View from the context menu. You can choose to see the revision number, date, author of the change, commit number, and set highlighting.

  • Choose annotations options: right-click the annotations gutter and select Options from the context menu.

    • Ignore Whitespaces: whitespaces will be ignored (git blame -w). This means that annotations will point to the previous meaningful commit.

    • Detect Movements Within File: when a commit moves or copies lines within the same file, such change will be ignored (git blame -M). This means that annotations will point to the previous meaningful commit.

    • Detect Movements Across Files: when a commit moves or copies lines from other files that were modified in the same commit, such change will be ignored (git blame -C). This means that annotations will point to the previous meaningful commit.

Annotating previous revisions

GoLand lets you annotate not only the current file revision, but also it's previous revisions. The following options are available from the context menu of the annotations gutter:

  • Annotate Revision: this option is useful if you want to check what a file looked like after a particular change was committed. To do this, right-click this change and select Annotate Revision from the context menu.

  • Annotate Previous Revision: this option is useful if you find yourself in a situation when the last change in a particular line is meaningless, for example if all that was changed is code formatting. In this case, you can check what the previous revision of the file looked like. To do this, right-click a change and select Annotate Previous Revision from the context menu.

You can also annotate a particular file from the file history view. In the History tab, select the file version you want to review, right-click the corresponding line and select Annotate from the context menu.

Viewing the differences between revisions

To review the differences between the annotated version of a file and its previous version, position the cursor on an annotation, right-click it and select Show Diff from the context menu. GoLand opens the Differences Viewer for Files:

differences viewer

Navigating to log

If you are using Git for version control, you can also jump from the annotations view to the corresponding commit in the Log tab of the Version Control tool window.

To do this, position the cursor on an annotation, right-click it and select Select in Git log from the context menu. You can also use the Copy revision number command to located a revision in the log.

For projects hosted on https://github.com/, the Open on GitHub command is also available that takes you to the corresponding commit.

Last modified: 6 February 2019