Git Blame in VS Code: 4 main extensions (2023)

Most production projects involve a team, so even one file can have multiple collaborators. When things go wrong, it's important to understand how and why certain code changes were made, and by whom.

This is easily done with the powerful Git Blame command in VS Code. You can use it to determine who wrote each line of code in a particular file.

In this post, we'll look at different ways to use the git blan command in VS Code. Multiple commands may be required to check each file. But instead, we can use some awesome extensions in VS Code to implement the same processes and get faster results.

What is Git debt?

Git Blame is a Git version control command. List the authors of each line of code in the file. Here is the syntax:

Blame Git

In the following example, we use Git Blame to find changes made to a file. Note that we need to provide the full path as well as the file name. The author of each line is listed here. We also see that almost all of the changes were made by the user named ankit, but the change in line 16 was made by the user nabendu82.

Git Blame in VS Code: 4 main extensions (1)

The above project is a large React.js project with many files. So it will be very difficult to check the different authors of each file from the command line. In the next section, we'll look at better ways to achieve this with VS Code extensions.

Extensiones VS Code Git Blame

As we just saw, manually checking the author on each file from the command line is a lot of work. Instead, we can use four extensions in VS Code that will help us easily find the author of each line of code. Now, most of the extensions in VS Code, like VS Code itself, are free. These extensions are generally small programs that add functionality to VS Code.

We will see the following extensions to add Git Blame to our project:

  • git bug
  • GitLens
  • gypsy story
  • gita diagram

git bug

We open our previous project in VS Code. You can open any project, but it's useful when your code has multiple authors. Then we need to click on the "Extension" tab on the left bar. Here, in the input field, search for "guilt" and press Enter.

We will get many extensions, but we click on the firstGit Blame de Wade Andersonand has 1.3 million downloads. Then click the "Install" button to install this extension in VS Code.

Git Blame in VS Code: 4 main extensions (2)

After a successful installation, we see thisDeactivateIuninstallKeys.

Git Blame in VS Code: 4 main extensions (3)

(Video) VS Code tips — Line blame annotations from the GitLens extension

We don't need to do any other configuration to use this extension. Now we can open any file and click on any line.

To illustrate what this looks like, we open the same Community.js file we checked from the terminal. We clicked on poem 11 and in the bottom bar we see the author of this poem. We will also see what time the commit was made.

Git Blame in VS Code: 4 main extensions (4)

Here we clicked on another poem and it turned out to be by another author. Then click on the author's name in the blue bar below.

Git Blame in VS Code: 4 main extensions (5)

Clicking on the name will open a popup window with a commit message from Git. There will also be a "View" button, so let's click on it.

Git Blame in VS Code: 4 main extensions (6)

This will open the GitHub changes in the browser with the commit details.

Git Blame in VS Code: 4 main extensions (7)


GitLensis the most popular extension for Git Blame. In fact, it is the most popular VS Code extension with 17 million downloads. We will search for "Git Blame" again.renewaltab and GitLens is the second. This extension was created by GitKraken and the full name is GitLens - Git supercharged.

Git Blame in VS Code: 4 main extensions (8)

This extension provides several ways to detect Git errors. It offers basic features for all users as well as advanced features for advanced users.

basic functions

The main way to use GitLens is to click on a line of code whose author needs to know. Displays the author's name along with the approval message and time in light gray text.

Git Blame in VS Code: 4 main extensions (9)

If we hover over the gray text, we get more information. Note that the first time we use it, we'll also be prompted to connect to GitHub.

(Video) VS Code tips — GitLens: Toggle file blame annotations

Git Blame in VS Code: 4 main extensions (10)

When you click "Connect to GitHub", a popup window will appear. Click Allow.

Git Blame in VS Code: 4 main extensions (11)

GitHub then asks us to give it permission in our browser.

Git Blame in VS Code: 4 main extensions (12)

Again, GitHub will ask for your permission to open VS Code. Click Allow.

Git Blame in VS Code: 4 main extensions (13)

Again, we need to allow access through VS Code.

Git Blame in VS Code: 4 main extensions (14)

We finally have access. Now, as soon as we hover over the Git Blame message, we get more details about the commit.

Git Blame in VS Code: 4 main extensions (15)

advanced features

We can click on the Git Blame message in the bottom blue bar. This will open a popup window where we can do a lot of things like open a commit in Git or revert a commit.

Here we click on the approval message for more information.

Git Blame in VS Code: 4 main extensions (16)

In the sidebar, we see more details about the approval.

(Video) TOP 6 GIT Extensions You Need In VS Code

Git Blame in VS Code: 4 main extensions (17)

Another powerful feature of GitLens is the ability to view file-wide commits. To do this, click the GitLens icon in the upper right corner. A popup window will open, click on itChange the blame for the file.

Git Blame in VS Code: 4 main extensions (18)

Now we see the commits of the entire file by different authors.

Git Blame in VS Code: 4 main extensions (19)

gypsy story

gypsy storyis a simple VS Code extension that allows us to monitor various git bugs. We look for "Git Blame" again.renewalTab. This is the third extension and has six million downloads. This extension is from Don Jayamamanne.

Git Blame in VS Code: 4 main extensions (20)

Once the extension has been successfully installed, right-click on any file. The menu displays two new options for viewing Git changes. Here we click nextGit: Show file history.

Git Blame in VS Code: 4 main extensions (21)

This will open all the commits in the file in a new tab. We can click on any of them. Here we click on the first commit.

Git Blame in VS Code: 4 main extensions (22)

This will show us all the files that have been modified in this commit at the bottom of the page.

Git Blame in VS Code: 4 main extensions (23)

Now we clicked on another commit and then on this oneanteriorbutton in a single confirmation.

Git Blame in VS Code: 4 main extensions (24)

(Video) How to open a commit online using the Git Blame VSCode Extension

This will open your changes in another tab.

Git Blame in VS Code: 4 main extensions (25)

We can also see the change in each row by right clicking and then clickingGit: Show line history.Row changes will open in a new tab.

Git Blame in VS Code: 4 main extensions (26)

gita diagram

gita diagramis another simple Git Blame extension that displays all Git changes in a graphical format. Again, we look for "Git Blame" in the "Extension" tab. This is the fourth expansion and it has three million downloads. This extension is made by mhutchie.

Git Blame in VS Code: 4 main extensions (27)

When the extension is installed correctly, we will see it in a blue bar. We just have to click on it and then all our branches will appear with all the commit messages. Here we clicked on the second confirmation message.

Git Blame in VS Code: 4 main extensions (28)

All files updated by this commit will be listed.

Git Blame in VS Code: 4 main extensions (29)

Then we click approval, renaming the YouTube link. And then to the only file that changed, Community.js.

Git Blame in VS Code: 4 main extensions (30)

Now we can see the changes to this file in split screen.

Git Blame in VS Code: 4 main extensions (31)


In this post, we talk about what the "Git Blame" command is and the difficulties of using it from the terminal. We also reviewed four Git Blaze extensions in VS Code that make it easy to verify who wrote each line of code.

(Video) GitLens Extension in Visual Studio Code

Of the four Git Blame VS Code extensions, GitLens is the clear winner. It has the most features and is also the most popular.


How to use Git blame in Visual Studio Code? ›

We can click on the git blame message on the bottom blue strip. It will open a pop-up in which we can do a lot of things like opening a commit on git or resetting the commit. Here we are clicking on the commit message to get more details. In the sidebar, we will see more details about the commit.

How to use git extensions in VS Code? ›

All the GitExtensions commands are available via the Command Palette:
  1. GitExtensions: Blame current file.
  2. GitExtensions: Create a branch.
  3. GitExtensions: Browse repository.
  4. GitExtensions: Commit.
  5. GitExtensions: Checkout a branch.
  6. GitExtensions: Checkout a revision.
  7. GitExtensions: See in Diff Tool.
  8. GitExtensions: See File History.
Feb 15, 2023

What is Git repository extension for VS Code? ›

GitHub Repositories extension. The GitHub Repositories extension lets you quickly browse, search, edit, and commit to any remote GitHub repository directly from within Visual Studio Code, without needing to clone the repository locally.

How to resolve git conflicts in VS Code? ›

Use the Git Changes window to create a merge commit and resolve the conflict. If you need to keep all of your changes to a file, you can right-click it in the Unmerged Changes section and select Keep Current (Local) without having to open Merge Editor.

How do I enable Git in Visual Studio? ›

To configure Git settings in Visual Studio, choose Settings from the top-level Git menu. Choose Git Global Settings or Git Repository Settings to view and configure global-level or repository-level settings. You can configure several common Git settings, as described in the following sections of this article.

What is the Git blame function? ›

The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was. The output format of git blame can be altered with various command line options.

How to connect Git to Visual Studio? ›

In the Visual Studio IDE, select the Git menu, and then select Clone Repository. Follow the prompts to connect to the Git repository that includes the files you're looking for.

How do I configure extensions in VS Code? ›

You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (Ctrl+Shift+X). This will show you a list of the most popular VS Code extensions on the VS Code Marketplace.

How to work with Git extension? ›

Committing to Local Repository with Git Extensions
  1. To start the process click the 'Commit' icon.
  2. The respective fields are displayed in the newly opened commit window (Refer figure): Working directory files. ...
  3. Commit the files using the 'Commit' button. The status of the commit operation is displayed in a dialog window.

How to check if Git is installed? ›

Open the command prompt "terminal" and type git version to verify Git was installed.

How to avoid code conflict in Git? ›

Pay attention and communicate
  1. creating branches.
  2. creating pull requests.
  3. Avoid allowing pull requests to become stale.
  4. Make sure you're not changing the same lines of code before merging a prior change.
  5. Establish and follow formatting rules.
Jun 14, 2022

How do I manually resolve Git conflicts? ›

The easiest way to resolve a conflicted file is to open it and make any necessary changes. After editing the file, we can use the git add a command to stage the new merged content. The final step is to create a new commit with the help of the git commit command. Git will create a new merge commit to finalize the merge.

How to resolve conflicts in Git without commit? ›

How to Resolve Git Stash Conflict Without Commit?
  1. Step 1: Switch to Git Repository. ...
  2. Step 2: Generate and Update File. ...
  3. Step 3: Track File. ...
  4. Step 4: Push Changes to Git Repository. ...
  5. Step 5: Update File. ...
  6. Step 6: Git Stash. ...
  7. Step 7: Modify Existing File. ...
  8. Step 8: Staged Add Changes.

How to resolve conflicts? ›

Some Ways to Resolve Conflicts
  1. Talk directly. Assuming that there is no threat of physical violence, talk directly to the person with whom you have the problem. ...
  2. Choose a good time. ...
  3. Plan ahead. ...
  4. Don't blame or name-call. ...
  5. Give information. ...
  6. Listen. ...
  7. Show that you are listening. ...
  8. Talk it all through.

How do I know if VS Code is connected to git? ›

To determine if GIt is installed and detected by the Git extension, click on the Source Control button or press CTRL+SHIFT+G while inside the VS Code window. If Git is not installed or detected, you would see a message, similar to the one below.

Why Git is not working in visual studio code? ›

Enable Git in VS Code

Go to Settings. Type Git: Enabled in the search bar. Make sure that the box is ticked.

What is the Git commit command? ›

The "commit" command is used to save your changes to the local repository. Note that you have to explicitly tell Git which changes you want to include in a commit before running the "git commit" command. This means that a file won't be automatically included in the next commit just because it was changed.

How do I see blame on GitHub? ›

On, navigate to the main page of the repository. Click to open the file whose line history you want to view. Above the file content, click Blame. This view gives you a line-by-line revision history, with the code in a file separated by commit.

What is blame in source control? ›

Git blame is the command that can tell you who was the last person to modify each line of code and when.

What is raw and blame in GitHub? ›

The Raw button, like the name suggests, opens the file in a raw form, meaning that any HTML formatting disappears. This is particularly useful when you want to download a single file.

Does Visual Studio have Git integration? ›

Seamless integration with GitHub

Authenticate your or GitHub enterprise account to create a repository, and push your first commits to GitHub, all through Visual Studio.

How to access Git command line from Visual Studio? ›

While in Visual Studio, open a command prompt in your repo from Team Explorer's Connect view. Right-click your local repo and select Open Command Prompt. Some commands require having specific Git permissions in Azure Repos to complete.

How do I manage extensions in Visual Studio? ›

To open the Manage Extensions dialog, choose Extensions > Manage Extensions. Or, type Extensions in the search box and choose Manage Extensions. The pane on the left categorizes extensions by those that are installed, those available on Visual Studio Marketplace (Online), and those that have updates available.

How do I enable workspace extensions in VS Code? ›

Open a new workspace / folder. Disable all extensions using Disable . Enable all extension that you want to have enabled in every new project with Enable . Enable extensions that you only want to use in this particular workspace / folder with Enable (Workspace)

How do you debug extensions for VS Code? ›

Debugging the extension

VS Code's built-in debugging functionality makes it easy to debug extensions. Set a breakpoint by clicking the gutter next to a line, and VS Code will hit the breakpoint. You can hover over variables in the editor or use the Run and Debug view in the left to check a variable's value.

What is the difference between Git and Git extensions? ›

Git GUI is part of the Git installation, along with Git Bash. Git Extensions is built on top of Git. Please provide additional details to your problem.

How to connect to Git through command line? ›

Using Git via Command Line
  1. Step 1: Get SSH Access. Connect to your server via SSH. ...
  2. Step 2: Generate SSH Key (Master Credentials Only) ...
  3. Step 3: Upload the SSH Public Key to Your Git Repository. ...
  4. Step 4: Deploy Code Using Git Commands.

How to use Git and GitHub with Visual Studio Code? ›

  1. In VS Code, in the Activity Bar, click the Remote Explorer icon. ...
  2. Select "GitHub Codespaces" from the dropdown at the top of the "Remote Explorer" side bar, if it is not already selected.
  3. Click Sign in to GitHub.
  4. If you are not currently signed in to GitHub you'll be prompted to do so.

How do I change a Git repository in VS Code? ›

Select one of your repositories, and then select the repository location, which must be a folder. Once you choose the folder, you click the Select Repository Location button. After this, we need to set the Git username and email address with the git config command on the terminal.

How to connect Git to GitHub to Visual Studio? ›

In Visual Studio, select Team Explorer from the View menu. In the Team Explorer pane, click the Manage Connections toolbar icon. Click the Connect link in the GitHub section. If none of these options are visible, click Manage Connections and then Connect to GitHub.

How to check git status in visual studio? ›

Visual Studio displays the current branch in the selector at the top of the Git Changes window. The current branch is also available in the status bar on the bottom-right corner of the Visual Studio IDE. From both locations, you can switch between existing branches.

Where is git usually installed? ›

The default path is “C:\Program Files\Git“. If you want the software installed in a different location click Browse and specify a different folder.

Where do I run my git commands? ›

For one, the command line is the only place you can run all Git commands — most of the GUIs implement only a partial subset of Git functionality for simplicity.

How to use Git in Visual Studio Code terminal? ›

Opening a Git Repo in VS Code
  1. Select the source control icon located on the activity bar.
  2. Then select Clone Repository.
  3. Navigate to your preferred repository hosting service, like GitHub.
  4. Navigate to the search bar at the top left corner, search for your desired remote repository, and select the repo.

What is blame used for in git? ›

The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was.

How to connect Git with Visual Studio? ›

In the Visual Studio IDE, select the Git menu, and then select Clone Repository. Follow the prompts to connect to the Git repository that includes the files you're looking for.

How to run Git commands in terminal? ›

For Windows, when installing Git through the installer, it is recommended you select the “Use Git from the Windows Command Prompt” option. This will allow you to use all git commands through your terminal (CMD, PowerShell, Anaconda) rather than having to use Git's personal terminal, Git Bash.

What is the need to assign blame? ›

Assigning blame allows the blamer to avoid taking any responsibility for their own actions and say the conflict is entirely the responsibility of the other person. However, conflict is rarely found to be the fault of solely one person. Blame does not change the argument or the facts of the situation.

Why do we assign blame? ›

We blame others to dispose of problems and protect our sense of self-worth when things go bad. We take credit ourselves to enhance our sense of self-worth when things go well.

How does blaming work? ›

Blaming is simply the act of assigning responsibility for something that happened. However, it's usually a negative act – you blame someone for breaking your favorite coffee mug, but you rarely blame someone for mowing the lawn, for instance.


1. VSCode Extension: Git Blame: Line History and Bookmark
2. GitLens Tutorial: How to Use GitLens in VS Code
3. VS Code tips — Workspace recommended extensions
(Code 2020)
4. Top 5 Git extension for VS Code. Github extension for vs code
(Ved The Master)
5. Visual studio code extensions for Git : Git Lens and Git History
(Shrideep ghag)
6. GitLens Tips | 11 Tips for Using GitLens in VS Code


Top Articles
Latest Posts
Article information

Author: Ouida Strosin DO

Last Updated: 10/01/2023

Views: 5529

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Ouida Strosin DO

Birthday: 1995-04-27

Address: Suite 927 930 Kilback Radial, Candidaville, TN 87795

Phone: +8561498978366

Job: Legacy Manufacturing Specialist

Hobby: Singing, Mountain biking, Water sports, Water sports, Taxidermy, Polo, Pet

Introduction: My name is Ouida Strosin DO, I am a precious, combative, spotless, modern, spotless, beautiful, precious person who loves writing and wants to share my knowledge and understanding with you.