git - 为什么在 powershell 和 posh git 中没有黄色

标签 git powershell posh-git

好的,所以在 git bash 中这个 cmd..

git log --pretty='%C(yellow)%h%Creset %s' --abbrev-commit

给我一​​个黄色的提交 ID 和白色的主题行,但是在 powershell 中(使用 posh git)我没有得到黄色的提交 ID(它是默认的白色)。

为什么?

最佳答案

事实证明,PowerShell 的控制台将 System.ConsoleColor.DarkYellow 呈现为白色:

[Enum]::GetValues([ConsoleColor]) | %{ Write-Host $_ -ForegroundColor $_ }

使用 bold yellow 代替,它使用 System.ConsoleColor.Yellow 呈现,有效:

git log --pretty='%C(bold yellow)%h%Creset %s' --abbrev-commit

关于git - 为什么在 powershell 和 posh git 中没有黄色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11515089/

相关文章:

git - 当指定 --no-color 时,不要使用 git log --pretty 对引用进行着色

java - JGit 将 Repo A merge 到 fork 版本 repo B 中,其中 A 领先于 B

git - 在 Ubuntu 中从源存储库升级 git

powershell - 如何使用 PowerShell 固定到任务栏

powershell - 文件外没有写入错误,只有成功

powershell - 如何为 Internet Explorer 创建 URL 快捷方式

git blame 使用 -L <n,m> 选项抛出一个错误的修订错误

git stash 应用未知选项 : -encodedCommand error

git - .gitmodules 和在 .git/config 中指定子模块的区别?

Git 推送 : "fatal ' origin' does not appear to be a git repository - fatal Could not read from remote repository."