DEV Community

G.L Solaria
G.L Solaria

Posted on

GitLens: where have you been all my life!

I have been using Visual Studio Code more and more lately. I recently stumbled across GitLens and I must say I am blown away by it.

If I want to know who modified a line last and view all the changes they made to a file, I simply do this:

Now say I am interested in finding out all the recent changes from a source file, I simply do this:
Recent diffs

The ole git blame is there too:
git blame

Now if I am interested in what has changed between 2 branches or tags, I can do this:
Branch tag compare

These are just a few of the great features. If you use git and Visual Studio Code, this extension is well worth a look.

Discussion (26)

ptejada profile image
Pablo Tejada

The JetBrains IDE have had this VCS functionality for as long as i can remember and then some. If they provide an IDE for your language of choice, i strongly recommend to check it out.

geni94 profile image
geni94 • Edited on

JetBrains has far superior IDEs than anyone else IMHO. There's this little thing that they're not free though, and not everyone is willing to pay $300 for a license when open-source options are available.
For instance, I use only WebStorm on my work desktop and VS Code on my laptop πŸ˜…

eerk profile image

I've been trying to use WebStorm / PHPStorm but just can't get past the crazy complicated settings screens and cluttered UI. I gave up when trying to convince WebStorm that ES6 needs no semicolons after a line of code. After changing this setting in more than 6 different settings screens, it still wasn't allowed.

ptejada profile image
Pablo Tejada • Edited on

Is a matter of getting used to it for sure. I've been using PHPStorm for so long that almost everything comes to me naturally. What you are describing is the code inspection highlights which you have full control of.

You can edit any inspection warning/error directly from the editor without even having to go the setting page:

  1. Place your cursor over the highlighted symbol
  2. Press Alt + Enter to open the intention options or context menu.
  3. Highlight one of the intentions with the arrow keys(↑/↓), an intention usually has an orange light bulb next to it, then press the β†’ key to see additional options.
  4. In the additional options dropdown you will have multiple options which includes disabling the inspection rule altogether and an action that takes you directly to the configuration section to edit the specific inspection rule among other actions.
Thread Thread
eerk profile image

Thanks for the hint! Of course it's always a matter of getting used to software. PHPstorm certainly has gazillions of options. I just find VS Code more intuitive, with less menus buried deep within other menus.

malixsys profile image
Martin Alix

Just add a Prettier config to your package.json and it will ask and apply code formatting based on those settings to your whole project...

eamodio profile image
Eric Amodio

Glad to see that you find GitLens useful! Great quick overview of it's features -- thanks!

simbo1905 profile image
Simon Massey

Totally! I have been raving about it at the office. The corporate proxy and security software prevent devs using VS Code for Java by blocking the Java plugin but I tell Java folks is worth running VS Code and GitLens as a second IDE as it is so much better than the git integrations of the other IDE's.

my profile image
Mindaugas Sharskus

For me Atom git support is the best from what I tried. Usually I run Atom just for it, well untill I become more familiar with cli.

charlessiwele profile image
Charles Siwele

I usually use VS code for the coding cause its really intuitive but the VCS integration and intuition I've alwats found to lag behind that of jetbrains IDEs, as such I find myself running Pycharm strictly for VCS purposes while I do actual code work in VS code. it's been working well for me of late however I would like see myself moving from using 2 IDEs to just one, but I love both for the purposes I use them for. Great post though I'll be installing this and trying it out soon!

jeastham1993 profile image
James Eastham

It's a fantastic plugin isn't it! I love the Git integration out of the box in VS code, but GitLens took it to the next level.

cosmic53 profile image
Michele Costabile

The Git blame view of the old gitk of yore was pretty useful too, and it comes free with the command line tools of Git for Windows, if you work on that. On Linux it is an easy install. On MacOS it might be complicated.

glsolaria profile image
G.L Solaria Author • Edited on

Oh wow gitk is based on TCL/TK. I haven't seen a TCL/TK app for a looong time. I just had a quick play with gitk and it reminds me a lot of SourceTree but gitk is better. But I still think GitLens is the best!

my profile image
Mindaugas Sharskus

GitToolbox for the JetBrains IDE's users.

adrienhorgnies profile image
Adrien Horgnies

As others have mentioned, it's packaged into Jetbrains VCS plugin. It has been one of my everyday tool since ever.

amatosg profile image

For IntelliJ, install GitToolBox

luturol profile image
Rafael Ahrons

Damn, that is pretty useful!!!

reisclef profile image
Richard C • Edited on

Totally agree. I've been begrudgingly using Sourcetree (I use a mac at work) and as soon as I started using gitlens, it became my default. Feels like the version control VSCode should have by default!

lauragift21 profile image
Gift Egwuenu

I've been using Git Lens for some time now and I totally love it.

foodbeez profile image
Sai Krishna

Nice find! I think I'll use this, thanks!

mobenali profile image
Mohamed Halawa

It's a great choice, but if you ever considered a standalone git-gui i would recommend git extensions it's fully-featured with more control over your repo and awesome integeration with windows context menu and much more!

richwandell profile image
Rich Wandell

Today I was trying to use vscode and couldn't get past the poor git integration so I went back to jetbrains. This plugin though... Will try it out

ahmedayman profile image
Ahmed Ayman

Phpstorm and jetbrains products have this out of the box already.

richardeschloss profile image
Richard Schloss

I stumbled on this too around June and had the same reaction as you! I love this tool!

aleon1220 profile image
Andres Leon

yes it seems great. Thanks.