How to see local history changes in Visual Studio Code?

Visual Studio-Code

Visual Studio-Code Problem Overview


I'm looking for a way to see my local history changes.

Kind of the equivalent way in WebStorm: enter image description here

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

VSCode now offers this in the Timeline view, see Mark's answer.

Or alternatively, if you want a plugin to give you similar functionality. Eg.:

https://marketplace.visualstudio.com/items?itemName=micnil.vscode-checkpoints

Or the more famous:

https://marketplace.visualstudio.com/items?itemName=xyz.local-history

Some details may need to be configured because the VS Code search gets confused sometimes because of additional folders created by this type of plugins. To fix this you can:

  1. Add the history folder to your .gitignore file.
  2. Change the history folder location in the chosen plugin configuration.
  3. Configure the VS Code search to ignore the history folder.

Solution 2 - Visual Studio-Code

I built an extension called Checkpoints, an alternative to Local History. Checkpoints has support for viewing history for all files (that has checkpoints) in the tree view, not just the currently active file. There are some other minor differences aswell, but overall they are pretty similar.

Solution 3 - Visual Studio-Code

Basic Functionality

  • Automatically saved local edit history is available with the Local History extension.
  • Manually saved local edit history is available with the Checkpoints extension (this is the IntelliJ equivalent to adding tags to the local history).

Advanced Functionality

  • None of the extensions mentioned above support edit history when a file is moved or renamed.
  • The extensions above only support edit history. They do not support move/delete history, for example, like IntelliJ does.

Open Request

If you'd like to see this feature added natively, along with all of the advanced functionality, I'd suggest upvoting the open GitHub issue here.

Solution 4 - Visual Studio-Code

Local File History

> Local history of files is now available from the Timeline view. > Depending on the configured settings, every time you save an editor, a > new entry is added to the list:

Each local history entry contains the full contents of the file at the time the entry was created and in certain cases can provide more semantic information (for example indicate refactorings).

> From an entry you can: > > compare the changes to the local file or previous entry restore the > contents delete or rename the entry

see https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_66.md#local-history

Local file history is being actively worked on and is in the Insiders' Build v1.66. The results will be available in the Timeline view.

Here are the current applicable settings:

Workbench > Local History: Enabled

> Controls whether the local file history is enabled. When enabled, the > file contents of an editor that is saved will be stored to a backup > location and can be restored or reviewed later. Changing this setting > has no effect on existing file history entries.

Workbench > Local History: Max File Entries

> Controls the maximum number of local file history entries per file. > When the number of local file history entries exceeds this number for > a file, the oldest entries will be discarded.

Workbench > Local History: Max File Size

> Controls the maximum size of a file (in KB) to be considered for local > history. Files that are larger will not be added to the local history > unless explicitly added by via user gesture. Changing this setting has > no effect on existing file history entries.

local history settings

And these commands:

timeline.toggleExcludeSource:timeline.localHistory  

workbench.action.localHistory.compareWithFile
workbench.action.localHistory.compareWithPrevious
workbench.action.localHistory.selectForCompare     // compare any 2 entries
workbench.action.localHistory.compareWithSelected

workbench.action.localHistory.delete               // delete this entry
workbench.action.localHistory.deleteAll            // delete all entries of all files from local history

workbench.action.localHistory.open
workbench.action.localHistory.restore
workbench.action.localHistory.restoreViaEditor
workbench.action.localHistory.rename               // rename this entry

New global commands have been added to work with local history:

workbench.action.localHistory.create: create a new history entry for the active file with a custom name

workbench.action.localHistory.deleteAll: delete all history entries across all files

workbench.action.localHistory.restoreViaPicker: find a history entry to restore across all files

> A bunch of new settings have been introduced to work with local > history: > > workbench.localHistory.enabled: enable or disable local history > (default: true) workbench.localHistory.maxFileSize: a limit of > file size to create a local history entry (default: 256kb)
> workbench.localHistory.maxFileEntries: a limit of local history > entries per file (default: 50)
> workbench.localHistory.exclude: > glob patterns for excluding certain files from local history
> workbench.localHistory.mergeWindow: interval in seconds during which > the last entry in local file history is replaced with the entry that > is being added (default 10s)

Timeline local history commands menu

Solution 5 - Visual Studio-Code

There is no option in vscode to see file history. If you are using git, then you can use vscode extension Git History to see the file changes after each commit and compare with previous commits.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIdan DaganView Question on Stackoverflow
Solution 1 - Visual Studio-CodeBBaconView Answer on Stackoverflow
Solution 2 - Visual Studio-CodemicnilView Answer on Stackoverflow
Solution 3 - Visual Studio-CodejabacchettaView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeMarkView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeBadriView Answer on Stackoverflow