Git漂亮的格式颜色 [英] Git pretty format colors
问题描述
我正在尝试为Git设置漂亮的格式颜色。从我可以告诉的版本1.6.0只识别红色,绿色和蓝色。
$ git log --pretty = format: %Credred%Creset%Cgreengreen%Creset%Cyellowyellow%Creset%Cblueblue%Creset%Cmagentamagenta%Creset%Ccyancyan%Creset%Cwhitewhite%Creset
红色绿色%Cyellowyellow%Creset蓝色%Cmagentamagenta%Ccyancyan%Cwhitewhite
此外,没有任何颜色使用圆括号的颜色格式。
有没有办法列出Git可用的漂亮格式颜色?
不幸的是,这是在传统的SCO OpenServer 5.0上。 7机器和由SCO Skunkworks发布的Git的最新版本为1.6.0.3。
我没有旧版本的 git
来验证除 red以外的颜色,
blue
并支持 green
。
尽管我注意到最近版本的 git
(比如我使用的1.7.10)是 green
blue
需要位于括号内()
。对于红
,绿
和蓝
,括号是可选的。
所以试试这个:
git log - 漂亮=格式:%红色%Creset%Cgreengreen%Creset%C(黄色)黄色%Creset%Cblueblue%Creset%C(洋红色)洋红色%Creset%C(青色)青色%Creset%C(白色)白色%Creset
我知道的颜色列表至少包括:
正常
黑色
红色
绿色
黄色
蓝色
洋红色
青色
白色
可以结合以下属性之一:
加粗
dim
ul
眨眼
反转
如果您尝试使用 .gitconfig
更改颜色,您应该能够指定两种颜色 - 前景和背景,您可以将其与一个属性组合。
I'm trying to set up pretty format colors for Git. From what I can tell version 1.6.0 only recognizes red, green and blue.
$ git log --pretty=format:"%Credred%Creset %Cgreengreen%Creset %Cyellowyellow%Creset %Cblueblue%Creset %Cmagentamagenta%Creset %Ccyancyan%Creset %Cwhitewhite%Creset"
red green %Cyellowyellow%Creset blue %Cmagentamagenta %Ccyancyan %Cwhitewhite
In addition none of the colors work with the parenthesized color format.
Is there a way to list the available pretty format colors for Git?
Unfortunately this is on a legacy SCO OpenServer 5.0.7 machine and the last version of Git released by SCO Skunkworks was 1.6.0.3.
I do not have an old version of git
to verify that the colors other than red
, blue
and green
are supported.
Although, one thing I noticed even with the recent versions of git
(like 1.7.10 I used) is that colors other than red
, green
and blue
need to be within parentheses ()
. For red
, green
and blue
, the parentheses are optional.
So give this a try:
git log --pretty=format:"%Credred%Creset %Cgreengreen%Creset %C(Yellow)yellow%Creset %Cblueblue%Creset %C(magenta)magenta%Creset %C(cyan)cyan%Creset %C(white)white%Creset"
The list of colors I'm aware of at least are:
normal
black
red
green
yellow
blue
magenta
cyan
white
It can be combined with one of these attributes:
bold
dim
ul
blink
reverse
If you're trying to change colors using .gitconfig
you should be able to specify two colors - foreground and background and you can combine it with an attribute.
这篇关于Git漂亮的格式颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!