How To Use GitLens To Figure Out Who Introduced A Change In Your Code

Introduction: If you’re a software developer, you know that keeping track of changes to your code is essential. Git is a popular version control system that allows developers to track changes and collaborate on projects. However, identifying who introduced a specific change in the code can be challenging. This is where GitLens comes in. It is an extension for Visual Studio Code that adds powerful features to the Git capabilities built into the editor. In this article, we’ll explore how to use it to figure out who introduced a change in your code.

Understanding GitLens:

It is a powerful extension that provides enhanced Git capabilities to Visual Studio Code. It adds a range of features that make it easier to navigate, understand, and collaborate on Git repositories. Some of the key features of it include:

  1. Blame Annotations: This feature shows who made each change to a line of code and when. By hovering over a line of code, you can see the commit message, author, and date for the last change.
  2. Code Lens: This feature adds Git-related information to your code, such as the number of times a line has been changed or the number of authors who have contributed to the code.
  3. File History: This feature provides a visual representation of the changes made to a file over time, including who made the changes and when.
  4. Compare View: This feature allows you to compare different versions of a file side-by-side and see the differences between them.

Using GitLens to Identify Code Changes:

Now that we’ve covered some of the key features of GitLens let’s take a closer look at how to use it to identify who introduced a change in your code. Here’s a step-by-step guide:

  1. Install GitLens: The first step is to install GitLens in Visual Studio Code. You can do this by searching for “GitLens” in the extensions marketplace and clicking “Install”.
  2. Open the Code File: Next, open the code file that you want to investigate.
  3. Open the Command Palette: Press “Ctrl+Shift+P” (Windows) or “Cmd+Shift+P” (Mac) to open the command palette.
  4. Search for “GitLens: Toggle GitLens Blame Annotations”: In the command palette, search for “it: Toggle it Blame Annotations” and select it. This will enable the Blame Annotations feature in it.
  5. Identify the Code Change: Once the Blame Annotations feature is enabled, you can hover over a line of code to see who made the last change and when. You can also click on the line to see more detailed information, such as the commit message and the author’s name.
  6. Use File History to See More Changes: If you want to see a visual representation of the changes made to the file over time, you can use the File History feature. To access this feature, right-click on the file and select “it: View File History”. This will show you a timeline of the changes made to the file, including who made the changes and when.


GitLens is a powerful extension for Visual Studio Code that adds enhanced Git capabilities to the editor. By using it, you can easily identify who introduced a change in your code and see the changes made over time. Whether you’re working on a large team or just want to keep track of your own changes, it is a valuable tool for any software developer. So, if you’re not already using it, give it a try and see how it can help you streamline your development workflow.

Author – Top Educator in India

Leave a Reply

Your email address will not be published. Required fields are marked *