437

I can execute various Git commands from Visual Studio Code, however I couldn't find a way to visualize the history.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
rlesias
  • 4,786
  • 3
  • 15
  • 20

11 Answers11

301

You won't need a plugin to see commit history with Visual Studio Code 1.44 or more.

Timeline view

This is a unified view for visualizing time-series events (for example, Git commits, file saves, test runs, etc.) for a file. The Timeline view automatically updates showing the timeline for the currently active editor, by default. You can control this default behavior by toggling the eye icon in the view toolbar. Also, similar to other views, the Timeline view supports find or filter as you type.

The Timeline view is collapsed by default at the bottom of the File Explorer. Selecting the Timeline sash will expand the Timeline view.

enter image description here

[...]

Here is the Timeline view in action:

enter image description here

OfirD
  • 9,442
  • 5
  • 47
  • 90
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 50
    Can it show branch history? It seems to show selected file history. – Vimes Mar 10 '20 at 16:57
  • 3
    @Vimes No, for now it is a time-series events (here, Git commits) for a resource (file, folder). – VonC Mar 10 '20 at 16:59
  • 1
    @VonC is there a way in timeline to bring up diff details for then entire commit that the timeline view is showing for a specific file? Is there a way to render "git show " view in vsc vs command line vi editor experience? – myusrn Aug 24 '20 at 18:50
  • @myusrn Not that I know of. That would be a good question on its own. – VonC Aug 24 '20 at 19:18
  • @VonC okay thanks for clarification. While the [git history](https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory) extension mentioned earlier in this thread does provide a way to use ide for view and diff contents of all aspects of a commit in the history log i assumed an oob story would exist for this given timeline is sort of doing this already but at a file scope level. As suggested i created a new SO question for just that issue [here](https://stackoverflow.com/questions/63586751/does-visual-studio-code-have-ide-story-for-reviewing-git-commit-history-and-doin). – myusrn Aug 25 '20 at 20:40
  • 11
    It does not seem to show history for a folder, only for a single specific file. – PeteH32 Apr 09 '21 at 22:05
  • 2
    Saved my day. When I done `git reset --hard` I lost a file and wasn't able to restore it through `git`, so VSCode had the solution – testing_22 Oct 26 '21 at 12:21
286

I recommend you this repository, https://github.com/DonJayamanne/gitHistoryVSCode

Git History Git History

It does exactly what you need and has these features:

  • View the details of a commit, such as author name, email, date, committer name, email, date and comments.
  • View a previous copy of the file or compare it against the local workspace version or a previous version.
  • View the changes to the active line in the editor (Git Blame).
  • Configure the information displayed in the list
  • Use keyboard shortcuts to view history of a file or line
  • View the Git log (along with details of a commit, such as author name, email, comments and file changes).
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ThormaWeb.com
  • 2,993
  • 1
  • 10
  • 7
111

GitLens has a nice Git history browser. Install GitLens from the extensions marketplace, and then run "Show GitLens Explorer" from the command palette.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joseph Sheedy
  • 6,296
  • 4
  • 30
  • 31
  • 1
    The latest version of GitLens is really good. It adds a handy sidebar button and allows you to much better visualize changes across multiple branches. – cham Oct 29 '18 at 21:10
  • 1
    yes, i used that, and i highly recommended that extension because it can show in realtime when i click on some link , ref: https://academy.byidmore.com/post/Find-Out-Who-Working-on-This-Line-Via-GitLens-5bd710931bde484c8fbedd33 – yussan Oct 30 '18 at 02:58
  • 1
    @JosephSheedy, `GitLens` seams most popular (downloads) extension for reason. – prosti Jun 12 '19 at 06:42
  • Good plugin. Did too much overlaying for me. stackoverflow.com/a/60013101/229906 built in vscode was exactly what I was looking for. – 0llie Sep 22 '20 at 08:36
  • GitLens > gitHistory – Tchakabam Mar 04 '22 at 23:32
60

It is evident to me that GitLens is the most popular extension for Git history.

enter image description here

What I like the most it can provide you side annotations when some line has been changed the last time and by whom.

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
prosti
  • 42,291
  • 14
  • 186
  • 151
45

I would recommend using Git Graph extension.

arkhwise
  • 873
  • 9
  • 13
34

You don't need an extension to do this, you can just go to Explorer and then Timeline. Timeline in Explorer

If you don't want it in Explorer, you can drag and drop it to the Sidebar, or Source Control or anywhere you want!

in sidebar

If you want more fancy features like visualizing and all that stuff you need an extension.

Mayank
  • 1,595
  • 1
  • 11
  • 26
33

I strongly recommend using a combination of GitLens & GitGraph.

Below snapshot highlights how gitlens is showing commit over time

enter image description here

And the below picture is for the the amazing vivid GitGraph

enter image description here

helcode
  • 1,859
  • 1
  • 13
  • 32
16

Git Graph seems like a decent extension. After installing, you can open the graph view from the bottom status bar.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joe Phillips
  • 49,743
  • 32
  • 103
  • 159
2

You will find the right icon to click, when you open a file or the welcome page, in the upper right corner.

Enter image description here

And you can add a keyboard shortcut:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tobias Otto
  • 1,634
  • 13
  • 20
  • 22
    JIC: ... before to see this option, you need to have **Git History** extension previously installed. – Jhegs Nov 11 '18 at 23:31
  • 1
    Can you update your answer with the prerequisites (after testing it is actually the case)? – Peter Mortensen May 03 '20 at 20:34
  • Thanks @Jhegs, somehow I forgot about reinstalling that extension and was looking for this feature everywhere in the settings ‍♂️ – neojp Feb 19 '21 at 12:58
0

If you need to know the Commit history only, So don't use much Meshed up and bulky plugins,

I will recommend you a Basic simple plugin like "Git Commits"

I use it too :

https://marketplace.visualstudio.com/items?itemName=exelord.git-commits

Enjoy

KRISHNA
  • 189
  • 3
  • 8
0

There's another comfortable way to navigate the commit history for a file in Visual Studio Code by using the Gitlens extension.

That provides two functionalities, "File history" and "Line history", that are accessible from the VCS menu once Gitlens is installed.

Full explanations with example and doc reference provided in this answer.

mattiatantardini
  • 525
  • 1
  • 5
  • 23