posh-git doesn't show branch in package manager console

柔情痞子 提交于 2019-12-23 17:29:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!