豪华 git 不显示状态标志

posh git not showing status flags

我遇到了 posh git 未显示状态标志的问题。 这是它的样子:

如你所见,有变化,我的分支在原点后面,但提示仍然只显示青色的当前分支。虽然它在前面(绿色并且应该有 ~- 用于修改和删除的文件。

我确实再次删除了所有内容,并使用 PsGet Install-Module 重新安装了它。仍然没有运气。

我发现了为什么这不起作用。 GitUtil.ps1 (https://github.com/dahlbyk/posh-git/blob/master/GitUtils.ps1) 的方法 Get-GitStatus 包含对 git status 的调用,如下所示:

$status = git -c color.status=false status --short --branch 2>$null

但是为了让 git 在 PowerShell - ISE 中工作,我使用以下代码创建了一个 git.cmd:

@echo off
git.exe %1 %2 %3 %4 %5 %6 %7 %8 %9 2>&1

并添加了一个别名 git 来定位 cmd。正如我在这里描述的那样 (Powershell displays some git command results as error in console even though operation was successful)

这会破坏 posh~git GitUtils.ps1 的 git 状态解析。我将 GitUtils.ps1 更改为

$status = git status --short --branch