# Series: GitLens (3 Parts) — Luca Del Puppo > Complete 3-part technical series "GitLens" by Luca Del Puppo (https://delpuppo.net/blog/series/gitlens/). Ordered chronologically from Part 1 to Part 3. - **Canonical Series URL**: https://delpuppo.net/blog/series/gitlens/ - **Hashnode Series Mirror**: https://blog.delpuppo.net/series/gitlens - **Blog Index LLMs.txt**: https://delpuppo.net/blog/llms.txt ## Series Curriculum 1. [Part 1: Why I love GitLens in my VsCode - First Steps](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-first-steps/) (Feb 14, 2023) — In my daily routine, I work with git, and I suppose it's the same for you. I know all the standard... ([Article LLMs.txt](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-first-steps/llms.txt)) 2. [Part 2: Why I love GitLens in my VsCode - Blame & Compare](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-blame-compare/) (Feb 21, 2023) — When you work with git, you want to get info about commits and who changed the codebase... ([Article LLMs.txt](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-blame-compare/llms.txt)) 3. [Part 3: Why I love GitLens in my VsCode - Interactive Rebase](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-interactive-rebase/) (Feb 28, 2023) — One of the processes I typically do in my daily work is interactive rebase. I commit a lot, and then... ([Article LLMs.txt](https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-interactive-rebase/llms.txt)) --- ## Full Series Content ### Part 1 of 3: Why I love GitLens in my VsCode - First Steps - **URL**: https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-first-steps/ - **Published**: Feb 14, 2023 - **Tags**: git, vscode, gitlens, gitkraken In my daily routine, I work with git, and I suppose it's the same for you. I know all the standard commands to work with it in my terminal, and I love them. I think every developer must know git and its commands, and work with it by the command line. If you don't know at least the basic git commands, please go to study them right away. There are many articles or videos about them and don't forget the documentation; that is the best place to learn and study new things. When you have the fundaments, if you want to dive into it, this book is for [you](https://git-scm.com/book/it/v2). Btw, today I want to speak about something different, I love git and I love terminal, but sometimes I love having the info visualised appealingly and get info about the source control quickly. I work with VsCode typically, so some months ago I tried to find a solution for this editor that resolves what was said before. After googling and some testing, the result of my search was: [GitLens](https://gitlens.amod.io/). Now, I want to show you how it works and how it can improve your routine. So don't waste time and let's jump in it! ## Installation First of all, to use GitLens you have to install it. This process is a piece of cake if you are familiar with VsCode. - Open your editor - Go to the extension tab - Search "gitlens" - Install the extension ![GitLens Extension - Marketplace](https://cdn.hashnode.com/res/hashnode/image/upload/v1675949392926/0c267e07-6ef2-45db-9f60-dbdb4e04b720.png) _N.B. There are two extensions, the official and the insider; you can choose the one you prefer because the insider it's typically stable too. It goes without saying the insider version could have some bugs sometimes._ ## First Impact After the installation, the extension is ready to use, and you can find it in your sidebar. ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1675949347555/a1bceb62-a4b7-4f75-a794-e6291c0d2551.png) Before going on, I want to say you that the extension is free, but not all the features are free. Some cool features are available only in the pro subscription; you can find more [in this reference](https://help.gitkraken.com/gitlens/gitlens-plus/). As you can notice from the previous image, GitLens has different sections, and each section has its goal. Each title is already comprehensible as you can see, but now we'll deep into some of them and not only. I'll use the [Lyra](https://github.com/LyraSearch/lyra) repository for this article, so thanks to the [Lyra](https://docs.lyrasearch.io/) contributors if this article has a great git history and awesome code. ## Repository In this tab, you can find all the info about your repository: branches, commits, tags, contributors and so on. I use this section sparingly because, in other areas, I find these data based on my needs. But here, you can find the best overview of your repository. ![Repository Section](https://cdn.hashnode.com/res/hashnode/image/upload/v1675950838199/6947ddfd-273b-4f2a-abe4-00f7f6e37721.png) ## Commits This section starts to become more interesting. Here there is the commits list of the current branch. ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1675952586297/31483031-c2ef-4f92-9f3f-80b359dfaa92.png) Typically, I don't use this section to see the commit; I have a git alias showing me the terminal's history. But, in this section, there are 4 commands very helpful: - Undo the commit (please pay attention when you use it) - Compare the commit with the head - Copy the SHA - Open the commit in the browser ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1675952339619/dce93b28-5238-42a2-a403-b806c24391d6.png) The first, the second, and the last one are my favourites because I always forget the undo syntax, comparing the commit in some cases is very helpful using this tool, and opening the commit in the browser is straightforward in this way. Another cool feature presented in this section is the commit-graph. This is a pro feature, but it's very powerful to understand the status of the branches. You can find it in the title bar of the Commit section. ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1675952002559/82008c4c-ba55-4b20-9124-b33b2bc12c63.png) The result of this command is this ![Commit Graph](https://cdn.hashnode.com/res/hashnode/image/upload/v1675952181854/7a6d213f-e7da-4852-b1a1-4daf3d6885f3.png) With this graph understanding the branches' status or filtering or searching in your repository is easy, and you can find your answer quickly. This is very helpful for me when I want to check where my current branch is compared to the main branch or others. ## File history and line history These sections are incredible! If you have a file open in the editor in these two tabs, you can see the history of the file in your repository and the history of the line where your cursor is. Another cool integration are the notions present on the right of the current line directly in the file, where you can find the last commit's info of that line of code. So you can blame your colleague ðŸĪŠ ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1676026458930/77049c49-1de4-42b2-8dfb-4ab4f11f43ec.png) The last feature that I want to face out in this article is the button that permits to see the changes between the current version of the file and the previous one. This button is in the top right of the file and the result if you click it is like this. ![Changeset Button](https://cdn.hashnode.com/res/hashnode/image/upload/v1676027882197/c3ea11d4-ab76-4d12-b62f-282c4748608e.png) ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1676027914836/163ad3ea-717f-43a4-b3fe-e1abc7310d55.png) This feature is very cool and allow us to see immediately what has changed in the last commit. In this view, it's possible to continue the history navigation using the same icon at the top right of the button. ![Illustration for Why I love GitLens in my VsCode - First Steps](https://cdn.hashnode.com/res/hashnode/image/upload/v1676029929882/b095be9d-f1b1-4fd8-813e-d023e5b6b0b1.jpeg) So far so good; I suppose that as a first look at GitLens, that's all. In the next article, we'll dive into other cool features in GitLens, but for now, let me know what you think about it. Do you already use it? Which are your impressions in this case? See you soon folks Bye bye 👋 _If you are interested in it, use my referral_ [in this reference](https://www.gitkraken.com/invite/whbhwrJL) _to try GitLens or other GitKraken products for Free!_ [_https://www.gitkraken.com/invite/whbhwrJL_](https://www.gitkraken.com/invite/whbhwrJL) > 🎎 **Watch / View Embedded Resource:** [https://dev.to/puppo](https://dev.to/puppo) --- ### Part 2 of 3: Why I love GitLens in my VsCode - Blame & Compare - **URL**: https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-blame-compare/ - **Published**: Feb 21, 2023 - **Tags**: git, vscode, gitlens, gitkraken When you work with git, you want to get info about commits and who changed the codebase quickly. With GitLens, you can get much info about your current file without losing focus on it. First, at the top of your file, you can get info about the last change and the name of the person who pushed that commit. In addition, there is also info on the number of people that touched the file. ![Info at top of the file](https://cdn.hashnode.com/res/hashnode/image/upload/v1676888540974/b6a0ec97-63da-44f5-8944-4421cb88e95a.png) This information is clickable. You can click on the part relative to the last commit or the other one. The first part opens the VsCode command with some possible actions to see the commit; you can see all the files relative to the commit, open the commit detail, and see the commit in the commit-graph. This is very helpful if you want to get info quickly about the changes in the file. ![Result on click in the last commit](https://cdn.hashnode.com/res/hashnode/image/upload/v1676889210648/61e03949-5891-4fa9-b537-89a1af3a79d9.png) Instead, If you click on the second part (that is relative to the other authors of the file), GitLens opens a new bar on the left of the file and shows, for each line, the last commit relative to it, so you can understand who and why someone has changed the line. ![Blame bar](https://cdn.hashnode.com/res/hashnode/image/upload/v1676889388275/ffa12d59-9456-41f5-a386-88cb9f6d010b.png) This view is also available using the icon with the git logo in the top right of the file, and you can toggle this view by clicking it easily. ![Illustration for Why I love GitLens in my VsCode - Blame & Compare](https://cdn.hashnode.com/res/hashnode/image/upload/v1676889590594/8b474581-1fef-44eb-8e28-fde6061adbb9.png) All these features are fantastic, but sometimes we need more, for instance, searching for a commit or comparing two different commits. To do that, in the GitLens bar, you can find an option called "Search & Compare". ![Search & Compare](https://cdn.hashnode.com/res/hashnode/image/upload/v1676890305693/a237b1f8-8ac5-4360-8901-01e6224cc217.png) Let's start with the search feature. Using this feature, you can search for a commit by different filters: commit message, author, SHA, file or changes. Typically, in my case, I use this feature to find an old commit by message or by author. The feature is very straightforward. If you click the button, the extension opens a command with different options; you can select your choice and type your terms. After that, in the GitLens panel will appear the results of the search. ![Commit Search](https://cdn.hashnode.com/res/hashnode/image/upload/v1676892312451/5a4640a9-3f11-401b-b458-63f2751cb331.png) ![Search result](https://cdn.hashnode.com/res/hashnode/image/upload/v1676892324327/99fd4f55-6074-400e-9d7d-af6f41eb4f8c.png) With this view, you can check the commits and see the files changed in those commits. After the search could be necessary to compare two commits, you can use the other button called "Compare references" to do that. Also, this feature is easy to use. Clicking the button "Compare References" appears a new VsCode command, where you can type the reference of your branches/tags or commits. Obviously, you have to indicate two references for the comparison. ![Compare references](https://cdn.hashnode.com/res/hashnode/image/upload/v1676893376968/36cf6c46-dc2d-4dbf-8ca3-bc185e3ac870.png) For me, this is really convenient when I have to compare two different versions of the code in the past or to check when and why a piece of code has changed. Ok, that's all folk. I hope you have other tips for improving your productivity with git using GitLens. Let me know if you think these features could be helpful to you too or if you already use them in your daily work. See you soon folks Bye bye 👋 _If you are interested in it, use my referral_ [in this reference](https://www.gitkraken.com/invite/whbhwrJL) _to try GitLens or other GitKraken products for Free!_ [**_gitkraken.com/invite/whbhwrJL_**](http://gitkraken.com/invite/whbhwrJL) > 🎎 **Watch / View Embedded Resource:** [https://dev.to/puppo](https://dev.to/puppo) --- ### Part 3 of 3: Why I love GitLens in my VsCode - Interactive Rebase - **URL**: https://delpuppo.net/blog/gitlens/why-i-love-gitlens-in-my-vscode-interactive-rebase/ - **Published**: Feb 28, 2023 - **Tags**: git, vscode, gitlens, gitkraken One of the processes I typically do in my daily work is interactive rebase. I commit a lot, and then before pushing the result, I try to make the history more readable. If you have to do that by CLI, you should follow many steps: ```bash > git log --oneline ``` This command returns the list of the commit ![Git commit history](https://cdn.hashnode.com/res/hashnode/image/upload/v1677330009538/2176c8e6-c851-4ee9-9dfb-14ec242a7219.png) Now, you have to get the SHA of the commit from where you want to start the interactive rebase and run the command ```bash > git rebase -i bf2478f ``` Now you can handle your rebase from your best editor, in my case VsCode. ```bash pick 4fcdf0e add documentation pick c7a47a9 add documentation # Rebase bf2478f..c7a47a9 onto bf2478f (2 commands) # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup [-C | -c] = like "squash" but keep only the previous # commit's log message, unless -C is used, in which case # keep only this commit's message; -c is same as -C but # opens the editor # x, exec = run command (the rest of the line) using shell # b, break = stop here (continue rebase later with 'git rebase --continue') # d, drop = remove commit # l, label