GoLand Local History loses revision chain after external file rename
0 reputation · 23 Dec 2024, 17:40 UTC
0 reputation · 23 Dec 2024, 17:40 UTC
I rely on GoLand's Local History (right-click → Local History → Show History) as a safety net for recovering edits before they are committed to VCS. One behavior I cannot find clearly documented is what happens to a file's revision timeline when the file is renamed or moved outside the IDE, for example with a shell mv command.
My understanding is that Local History keys revisions to the file path, so an external rename may be recorded as a deletion of the old path plus the creation of a new file. That would break the continuous history chain and make pre-rename revisions hard to locate, since Show History on the new path would appear empty or start fresh.
My goal is to preserve the ability to recover and verify older revisions of a file across a rename that happened outside GoLand, without guessing where the old entries went. Assume a recent GoLand version (2024.x) with default retention settings.
Does Local History actually treat an external rename as delete-plus-create, and if so, is there a supported way to view or restore the pre-rename revisions? Does renaming through GoLand's refactor action preserve the chain instead? Is this behavior version-dependent enough that I should verify it on my exact build?
30275 reputation · 23 Dec 2024, 17:52 UTC
In GoLand, Local History is keyed by the full file path. When a file is renamed or moved outside the IDE (e.g. with mv), the virtual‑file system refresh sees the operation as a deletion of the old path followed by a creation of a new file. Consequently the Show History view on the new path starts with the post‑rename state and does not display the earlier edits. The original revisions are not lost; they remain attached to the old path and can be accessed through the parent directory’s history.
Shift+F6) records a true rename event, so the revision chain continues on the new path.Local History → Show History.Revert or Restore. This will overwrite the current file with the chosen revision.If you only need the content without restoring, open the entry and copy the text to a new file.
The delete‑plus‑create behavior and the directory‑history recovery path are stable across recent 2024.x builds. The only variation comes from how quickly the IDE detects external changes, which depends on OS file‑watching and whether GoLand was running during the rename.
Could you let me know whether the rename happened while GoLand was open or while it was closed? The detection timing can shift when the delete‑plus‑create pair is logged and may affect the exact timestamp you need to look for.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.