Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update posh-git

I have an old version of posh-git that I want to update (while trying to solve slow powershell start ups)

I've pulls latest from the repo and when I am trying to do .\install.ps1 I get

It seems posh-git is already installed...

How do I update posh-git?

like image 651
Nick Ginanto Avatar asked May 20 '13 16:05

Nick Ginanto


People also ask

How do I know if Posh is installed on git?

Check that git is accessible from PowerShell by executing git --version from PowerShell. If git is not recognized as the name of a command, verify that you have Git installed. If not, install Git from https://git-scm.com. If you have Git installed, make sure the path to git is in your PATH environment variable.

Does posh-git work with git bash?

You can also tab complete remote names and branch names e.g.: git pull or<tab> ma<tab> tab completes to git pull origin master . “ Just to clarify, Git will work both through Git Bash and Posh-Git.

Does PowerShell have git?

Update PowerShell PromptTo include git information in your prompt, the posh-git module needs to be imported. To have posh-git imported every time PowerShell starts, execute the Add-PoshGitToProfile command which will add the import statement into your $profile script.


3 Answers

If installed via PsGet, you can just run

Update-Module posh-git
like image 138
Chris Clayton Avatar answered Oct 28 '22 10:10

Chris Clayton


All it does is look if the script is being sourced in your profile:

$profileLine = ". '$installDir\profile.example.ps1'"
if(Select-String -Path $PROFILE -Pattern $profileLine -Quiet -SimpleMatch) {
    Write-Host "It seems posh-git is already installed..."
    return
}

Since it seems to have the installDir as the folder from which you run the install script, merely upgrading the folder with the newer version of posh-git should give have updated the files already.

If you are not comfortable with that, just remove the line that sources the profile.example.ps1 in your profile and run the install again :)

like image 21
manojlds Avatar answered Oct 28 '22 08:10

manojlds


I had installed via PsGet, so I renamed the folder

C:\Users\[myName]\Documents\WindowsPowerShell\Modules\posh-git

and re-ran

Install-Module posh-git

It downloaded the latest but told me it was already installed, probably because I hadn't removed the lines from Microsoft.PowerShell_profile.ps1. That was all I needed, though.

like image 4
TrueWill Avatar answered Oct 28 '22 09:10

TrueWill