Jaa


More Git for Visual Studio Code

I already published several posts about Visual Studio Code and Git integration, including topics about GitHub and Team Foundation Service. Visual Studio Code supports lots of Git features that allow you to commit, push, pull your code directly from Visual Studio Code interface. Code even can help you to compare the current and the previous versions of your working files.

At the same time, Code doesn’t allow you to compare any two versions of a file or to get change log details. So, I was a little bit disappointed but it was prior extensions availability. You know that thanks to extensions you can easily extend Visual Studio Code and bring new functionality. And today, you can download one more cool extension for the existing Git subsystem and bring all missing features to Code – Git History extension.

You can install this extension using the standard way that we already discussed several times in my previous posts: simply call Command Palette and execute Install Extension command. From the extensions’ list you have to select Git History and click install button:

clip_image001

Once the extension is installed, Visual Studio Code will ask your permissions to restart and right after that you can start using Git History.

The extension contains two command that you can invoke from the Command Palette windows:

clip_image002

The first command View File History allows you to track history for a selected file. And the second command View Line History allows you to check what is happening with the current line of code (a line there the cursor is placed).

Prior to executing any of these commands you have to select a version that you pass to the command. It really helps to work with the extension as with a universal tool that is not chained to the latest version only but allows you to track changes any time.

clip_image003

Note that the extension is clever enough to select just those versions that make sense. For example, if you want to track a line but the line exists in the last three versions, the extension will show just them.

If you select View Line History, the extension will show that is happened with the line in the selected version:

clip_image005

In order to show all output information, the extension uses the Git output window. So, you will be able to see all other Git related messages in the same window.

If you select View File History, you can choose between several variations: View Change Log, View File Contents, Compare against workspace file and Compare against previous version.

clip_image006

The first command allows to show information about the commit like author and commit message. The second command just displays file content that is associated with the selected version. Finally, two next commands allow you to compare the selected version with the working version or against the previous to selected version:

clip_image008

So, you can see that the extension is powerful enough to help doing some common Git related tasks. Today, the extension has more than seven thousand users. So, looks like that it’s very popular and people like it.