问题
I installed posh-git for Windows PowerShell and it works great in the shell. However, it is supposed to work in the package manager console as well. It does work but it doesn't show the current branch like the normal powershell window does.
I followed this tutorial and everything went fine except for my package manager console doesn't look like his with the branch name.
All you can see is PM>
in the VS 2012 package manager console.
But it works fine in the powershell.
回答1:
Nuget has a separate profile (~\Documents\WindowsPowerShell\NuGet_profile.ps1), so it's not picking up the posh-git installed in your default profile.
The easiest way to get posh-git working is to run install.ps1
from the Package Manager Console. Or if you always want your profiles to match, you can load your default profile in the Nuget one:
$PROFILEDIR = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
Push-Location $PROFILEDIR
. .\Microsoft.PowerShell_profile.ps1
Pop-Location
(Edited to include switching to profile directory; capturing location in $PROFILEDIR
is optional, but I find it handy.)
来源:https://stackoverflow.com/questions/12454399/posh-git-doesnt-show-branch-in-package-manager-console