At one point I found a way to show line-by-line Git blame within Visual Studio Code. I now cannot recall or find the means with which to do that. I have the Git Blame extension, but that only shows blame on a single selected line.
11 Answers
Use the Gitlens extension. It supports various options. Once installed, you can use Alt+B to show the full file blame information.
-
196So they implemented a ton of functionality but not git blame natively?– apanzerjCommented May 21, 2018 at 22:29
-
29Or Ctrl+Shift+G B, if ones gitlens keymap is configured as 'chorded'.– vlad2135Commented Jan 24, 2019 at 12:01
-
15At least on macOS there is a "Show File Annotation" icon in the top right corner. That toggles a bar showing the blame for each line.– ManuelCommented Jul 11, 2019 at 23:09
-
8Where do you see "Show File Annotation"? I can't find it. Do you use a plugin for this? Commented Jul 14, 2019 at 9:01
-
13Once GitLens is installed, it also puts a little circular GitLens icon on the right of the tab bar (icon matches that for the extension in the left-hand activity bar). Clicking that will also show/hide the file blame area.– SamCommented Oct 31, 2019 at 12:36
If you use the GitLens plugin, you can also use the "File Annotations" icon in the top right of Visual Studio Code:
Or use the "GitLens: Toggle File Blame" command.
-
3
-
-
@Black you might not be in a git repo. i just tried: (1) new project: no icon. (2)
git init
: no icon. (3) git add and commit: no icon. (4) close and re-open that file: now the icon shows up as on the screenshot. (i am on the currently latestv13.6.0
)– omnesiaCommented May 26, 2023 at 15:33 -
@Black in my case it didn't show because the extension wasn't installed in WSL, when I was working on a WSL project.– s3cCommented Apr 22, 2024 at 12:19
I just installed Git Blame. It's out a while now, but it seems to be lightweight and very easy to use. I was able to get line-by-line details of who and when.
-
40This looks much better, and simpler. GitLens is completely overbloated. Commented Feb 18, 2023 at 14:26
-
Can you share how you got this to show like key combinations or whatever else it took? Commented Jun 1, 2023 at 8:56
-
4This one also shows blame info for every line that you ever move your cursor to, similar to GitLens. It doesn't offer a way to view git blame info a single time on demand like IntelliJ.– szxCommented Jan 30, 2024 at 9:19
-
2Thank you for your answer. I installed this extension and set
gitblame.inlineMessageEnabled
totrue
in my settings json file. It worked as I wanted it to.– debaghtkCommented Mar 3, 2024 at 15:25 -
2Caution: known performance issues. Spawns git process(es) every time you navigate to a line. Commented Aug 5, 2024 at 15:04
You can view the commit history for an individual file without a plugin using the Timeline view.
See How can I view the Git history in Visual Studio Code? for more information.
-
15But you can't view what commit a particular line was a part of directly Commented Jun 6, 2022 at 17:03
-
6@Ridhuvarshan yup, that is correct, but I didn't want to install another VSCode plugin and this was "good enough" for my case– SamBCommented Dec 7, 2022 at 19:16
-
5The question asks for a "git blame" equivalent: "show line-by-line git blame within vscode". You are giving a "git log" equivalent. Commented Jan 19, 2023 at 14:13
-
If you click the item, it shows the
diff
on the commit.... which was good enough for my use case (also didn't want to install another extension; I've used gitlens in the past but it was too heavy for me)– NSjonasCommented Feb 9, 2024 at 17:04
On Mac, if you have the GitLens plugin, it's Command + Option + G + B:
-
9this will only works with GitLens Plugin, which you don't mention...– snapCommented Jul 8, 2021 at 8:31
-
2To install GitLens, type
Command + Shift + X
, search "GitLens", click "install"– akkiCommented Oct 8, 2021 at 19:48 -
3Thank you. For anyone else who infrequently uses VS code like myself who was struggling to remember how to access the Command Palette pictured above, it's
Command + Shift + P
Commented Nov 12, 2021 at 16:17 -
3I have GitLens installed and
Command
Option
G
B
does nothing. Commented Nov 1, 2022 at 9:57 -
@Snowcrash I thought the same. It's Command+Option+G followed by B, NOT Command+Option+G followed by Command+Option+B. Commented Apr 3 at 10:18
Add the Annotator
extension. Here is the marketplace link to add it.
Source code: https://github.com/ryu1kn/vscode-annotator
-
possible usage:
ctrl + shift + p
, typeannotator
(or less), choose "Annotator: Annotate the current file or ...". Unfortunately (Annotator 1.0.0, VS Code 1.53.2), the annotated view is opened separately, with no syntax highlighting, block folding, scrolled to the top of the file andctrl + g
not working to go to the line– YakovLCommented Feb 25, 2021 at 10:25 -
This deserves a bit more attention. Great tool and not bloated like GitLens. Commented Feb 9, 2024 at 8:42
I don't like the way GitLens integrates into Visual Studio Code. After looking around and trying a number of other git-related extensions, I settled on Git History. It can be installed via VSCode Quick Open (typically, Ctrl+P) with ext install donjayamanne.githistory
.
It provides both full file and line-specific git blame from the context menu:
-
1This deserves more upvotes. I don't want VSCode to spawn git-processes every time I navigate to a line (like GitLens or Git Blame). I just want to see line history on demand. Commented Aug 5, 2024 at 15:03
-
I prefer Git History but it does not show full file git blame unfortunately, like line by line and this is very useful from time to time.– s3m3nCommented yesterday
GitLens provides the functionality of full-file git blame. To execute the command:
Press Ctrl+Shift+G, followed by pressing only B.
Note: When pressing B, do not press the Ctrl and Shift buttons. The command will work correctly in this manner.
I have personally validated this command on VS Code version 1.81.0 and GitLens version 14.2.0. Some users have reported issues with this command, but it's possible they are inadvertently pressing Ctrl and Shift buttons while pressing B.
-
1Thanks the tip to not press ctrl+shift when pressing B solved it for me Commented Nov 24, 2023 at 1:01
-
1
Just set
"git.blame.editorDecoration.enabled": true,
in VScode settings.
https://code.visualstudio.com/docs/sourcecontrol/overview#_git-blame-information
Git Blame W77 is a lighweight extension that does what you want. I tested it myself seems to work well.
As of today (April 2025), VSCode now includes built-in Git Blame support — you just need to enable it in the Settings.
https://github.com/microsoft/vscode/issues/205424#issuecomment-2504143954