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?
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.
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.
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.
If installed via PsGet, you can just run
Update-Module posh-git
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 :)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With