GoLand uses Local History to constantly track all changes made to projects. Unlike version control systems that show differences between specific commits, Local History automatically maintains revisions for all meaningful events. This produces a detailed timeline of changes in project structure and source code, with the ability to roll back to any point if necessary.
View Local History
On the VCS menu, point to Local History, and then click Show History.
Local History contains a list of revisions and shows differences between them. When viewing Local History for a directory, revisions show only names of files that changed in the directory. Revisions for a specific file contain changes to the contents of the file.
Revert to a specific revision
Select it from the list and click Revert on the toolbar.
This adds a new revision to Local History.
Viewing Local History for source code elements
In some cases, you may not want to view Local History for the whole file, but only for specific source code elements: classes, their members (fields and methods), or any selected fragment of text.
View Local History for a class
Right-click the class name in the editor, point to Local History, and then click Show History for Class.
View Local History for a class field
Right-click the field name in the editor, point to Local History, and then click Show History for Field.
View Local History for a class method
Right-click the method name in the editor, point to Local History, and then click Show History for Method.
View Local History for a source code fragment
Right-click the selected text in the editor, point to Local History, and then click Show History for Selection.
Adding labels to Local History
Local History contains revisions with timestamps, which are not easy to navigate. Some revisions are automatically marked with labels based on predefined events: running tests, deploying apps, committing changes, etc. You can also add custom labels to mark specific milestones in Local History.
Add a label to the current revision
On the VCS menu, point to Local History, and then click Put Label.
In the Put Label dialog box, type the label name and click OK.
Sharing Local History
Local History does not support shared access, it is intended only for personal use. However, you can create a patch file with changes relative to a specific revision, which you can share with others.
Generate a patch
Select the relevant revision in Local History and click Create Patch on the toolbar.
Viewing recent changes
Besides the detailed Local History, GoLand provides a summary of major recent changes to all projects.
View recent changes
On the View menu, click Recent Changes.
You can select the change you are interested in to review differences and revert it if necessary.
Retention period for Local History
By default, Local History is configured to store revisions for the last 5 working days (that is, days when the file was modified).
Change the retention period of Local History
On the Help menu, click Find Action or press Ctrl+Shift+A.
Find and open the Registry editor.
Modify the value of the
Click Close and restart GoLand for the changes to take effect.
Alternatively, you can pass the
localHistory.daysToKeep parameter as a Java property by. For example, to set retention to 30 days, add the following line to the JVM options file:
Location of Local History files
Local History is stored as binary files under the LocalHistory subdirectory in the GoLand system directory.
You can change the location of the system directory using the idea.system.path property.