Furin
Furin

Reputation: 572

VScode + git: compare file versions in file history

I'm wondering if in VScode it is possible to compare different file versions in file history and not only the actual local version with the latest version in GIT branch.

For example how can I compare the file version of 3/24/2020 with file version of 3/21/2020?enter image description here

Upvotes: 2

Views: 7141

Answers (3)

Mark
Mark

Reputation: 181050

If you want to compare ANY two versions of a file from your git Timeline view, looks like it is being added to vscode v1.54. The functionality has been merged and should be in the next Insiders' Build v1.54.

See also https://stackoverflow.com/a/73405473/836330 for filtering the Timeline view for "Git History" or "File History" only or both.

There will be context options to open a diff using the familiar Select for Compare and Compare with Selected commands.

time line compare demo

If you don't see a Timeline viewlet in the Explorer view, you can open it with View/Open View... and choose Timeline.

Upvotes: 3

Filter only "Git History" on Timeline

Others mentioned the Timeline tab, which allows you to see change history without any extensions.

However, the default view there can be confusing, as it shows both local changes (i.e. every time you do a Ctrl+F) in addition to actual Git commits.

If you go on the filter button of the tab however, you can unselect "Local History" and keep only "Git History", which gives the desired "git history of a given file".

Tested on VS Code 1.71.2.

Upvotes: 3

Bel Shazzar
Bel Shazzar

Reputation: 30

This is implemented in the newest update: https://code.visualstudio.com/updates/v1_44#_timeline-view

Upvotes: 1

Related Questions