在哪里可以找到 git 的所有颜色选项?

问题描述 投票:0回答:1

我想自定义我的 git 颜色输出。

  1. 在哪里可以找到可以指定颜色的所有选项的列表?

  2. 在哪里可以找到可以设置选项的所有颜色和修饰符?

例如,我在哪里可以找到完整的选项列表,例如:

color.ui
color.branch.current
color.branch.upstream
color.diff.new
color.diff.newMovedAlternative
color.diff-highlight.oldNormal
color.grep.match
color.interactive.help
color.status.untracked

以及颜色和修饰符列表,例如:

blue green red
bold dim blink strike no-bold
git git-config
1个回答
4
投票

这一切都由

git config
控制。

颜色列表可在 color 获取。正如那里所解释的,不同的控制台支持不同的颜色。例如,在 Windows 中,您在

PowerShell
cmd
或使用 Windows bash 端口的
mingw64
中看不到完全相同的颜色。

有很多颜色可以配置。例如,运行

git status
时使用的颜色是 here。但还有更多颜色,例如
diff
grep
merge
blame
...它们都有默认配置,我建议您除非必要,否则不要更改,以便任何使用您的
git 的人
环境,或者您使用其他环境,始终看到标准颜色。

如果运行

git config --get-regexp color
,您可以看到配置文件中配置的当前颜色,
.gitconfig
,但是,如上所述,这些只是您已明确更改的颜色。请参阅不同现有 git 配置文件的帮助:本地、全局、系统(存储库、用户、机器)。

© www.soinside.com 2019 - 2024. All rights reserved.