2015-11-08 53 views
1

改變git shell使用的顏色很簡單。例如,如果我想從紅色未跟蹤文件中的顏色更改爲「紅色加粗」,I型:Git顏色 - 分支描述文本

git config --local --replace color.status.untracked "red bold" 

關鍵是要知道每個顯示單元的設置名稱。

命令提示符始終會告訴您當前正在運行的分支以及狀態信息的摘要。摘要的顏色是紅色的。我希望它是一種不同的顏色。

表示摘要文本元素的設置名稱是什麼?

enter image description here

+0

其他的東西在控制着它。我知道在* nix系統(OS X,Linux)上,這是由'__GIT_PS1'設置/配置完全控制的,因此Git無法觸及的任何內容通常都會影響它。不知道它在Windows上是什麼,但我懷疑這是Git專門處理的配置。 – Makoto

+0

它是[posh-git](https://github.com/dahlbyk/posh-git) – BenV

回答

1

似乎提示顏色通過不同的機理的輸出顏色設置。

如果,PowerShell的命令行,鍵入

$global:GitPromptSettings 

您將看到有關如何git的提示顯示設置。一些值:

BranchBehindForegroundColor   : Red 
RepositoriesInWhichToDisableFileStatus : {} 
BranchForegroundColor     : Cyan 
BranchBehindAndAheadBackgroundColor : Black 
BranchBehindAndAheadForegroundColor : Yellow 
BeforeText        : [ 
WorkingBackgroundColor     : Black 
WorkingForegroundColor     : DarkRed 
EnableWindowTitle      : posh~git ~ 
BranchBehindBackgroundColor   : Black 
BeforeIndexText      : 
ShowStatusWhenZero      : True 
DelimText        : | 
BeforeBackgroundColor     : Black 
UntrackedForegroundColor    : DarkRed 
IndexForegroundColor     : DarkGreen 

我需要改變這裏的設置是WorkingForegroundColor

我可以打字測試更改此值的結果立刻:

$global:GitPromptSettings.WorkingForegroundColor = [ConsoleColor]::Green 

有用關於此主題的博客文章: