How to update posh-git
Asked Answered
S

3

11

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?

Suellensuelo answered 20/5, 2013 at 16:52 Comment(0)
A
10

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 :)

Adey answered 20/5, 2013 at 17:7 Comment(1)
even better, no pesky uninstall scripts.. worked well, thanks :)Suellensuelo
P
12

If installed via PsGet, you can just run

Update-Module posh-git
Pood answered 7/9, 2016 at 8:16 Comment(0)
A
10

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 :)

Adey answered 20/5, 2013 at 17:7 Comment(1)
even better, no pesky uninstall scripts.. worked well, thanks :)Suellensuelo
S
4

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.

Sectional answered 28/8, 2015 at 19:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.