SHARE:

Visual Studio 2019: New Windows Terminal has arrived, how to enhance it with posh-git for GIT usage?

Introduction

The new Windows Terminal has arrived on Visual Studio 2019 16.6 for Windows and Visual Studio 8.6 for Mac. In this article I will show how to enhance it with posh-git for a better experience with GIT commands.

Posh-Git

posh-git is a PowerShell environment for Git that provides powerful tab-completion facilities, as well as an enhanced prompt to help you stay on top of your repository status. Because The new terminal is compatible with PowerShell (and also classical command prompt) we are able to use them together for a better experience with GIT. Here is a tutorial to install it:

First, set the value of ExecutionPolicy to RemoteSigned for all users use the next command:

Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force

Then install it from the PowerShell gallery:

Install-Module posh-git -Scope CurrentUser -Force

At least update your PowerShell prompt with the following command:

Add-PoshGitToProfile -AllHosts

You can find here more documentation about it: https://github.com/dahlbyk/posh-git

Demo

Now you can open a new Windows Terminal from the menu here:

Then you can open as many windows as you want, remember, if you want to use posh-git, open a Developer PowerShell window:

If everything has been well installed your PowerShell window should look like this with posh-git:

As you can see your Git experience is really better, you won’t need to check your staged files on the Visual Studio Team explorer panel 🙂

Written by

anthonygiretti

Anthony is a specialist in Web technologies (14 years of experience), in particular Microsoft .NET and learns the Cloud Azure platform. He has received twice the Microsoft MVP award and he is also certified Microsoft MCSD and Azure Fundamentals.
%d bloggers like this: