Monday, October 17, 2022

Git in PowerShell with Posh-Git

Git in PowerShell | Posh-Git


Many of us prefer to use GIT from the command prompt and here many times we are confused about the branch and we have to find another command to know which branch is currently active. 

So here presenting the easiest and most likable way of using git from the PowerShell prompt.



Prerequisites for Windows

You need to set your local ExecutionPolicy to RemoteSigned. For administrators use -Scope LocalMachine and for the normal user -Scope CurrentUser


Run the below command to set the same,

> Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force

> Install-Module posh-git -Scope CurrentUser -Force

For all users, use -Scope AllUsers

Update PowerShell

To allow PowerShell to start with this PoshGit command you need to fire another command to allow the same behavior


Import-Module posh-git
Add-PoshGitToProfile -AllHosts


No comments:

Post a Comment

C# Interview Prep: 100 Common Questions for 0-3 Years Experience

Common C# Interview Questions  Basics of C# Language: What is C#? C# (pronounced C sharp) is a modern, object-oriented programming language...