好的,在Git Bash中使用这个命令...
git log --pretty='%C(yellow)%h%Creset %s' --abbrev-commit
在 Git Bash 中,我得到了带有黄色提交 ID 和白色主题行的效果,但是在 Powershell(使用 Posh Git)中,我没有看到黄色的提交 ID(它是默认的白色)。
为什么?
好的,在Git Bash中使用这个命令...
git log --pretty='%C(yellow)%h%Creset %s' --abbrev-commit
在 Git Bash 中,我得到了带有黄色提交 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