【发布时间】:2016-03-08 23:17:54
【问题描述】:
我遇到了 posh git 没有显示状态标志的问题。 这是它的样子:
正如你所看到的,我的分支在原点后面,但提示仍然只以青色显示当前分支。虽然它在前面(绿色,应该有 ~- 用于修改和删除的文件。
我确实再次删除了所有内容,并使用 PsGet Install-Module 重新安装了它。还是没有运气。
【问题讨论】:
标签: git powershell posh-git
我遇到了 posh git 没有显示状态标志的问题。 这是它的样子:
正如你所看到的,我的分支在原点后面,但提示仍然只以青色显示当前分支。虽然它在前面(绿色,应该有 ~- 用于修改和删除的文件。
我确实再次删除了所有内容,并使用 PsGet Install-Module 重新安装了它。还是没有运气。
【问题讨论】:
标签: git powershell posh-git
我发现了为什么这不起作用。 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
【讨论】: