"git branch -vv" 更改远程分支的颜色。

6
调用 git branch -vv 命令时,将本地分支映射到远程分支时,远程分支会显示为蓝色(在命令行工作时很难辨认)。如何将远程分支颜色更改为黄色等颜色?我还发现了这个未解决的Stack Overflow问题
2个回答

6

git config --global color.branch.upstream "yellow"

git config的文档中可知:

https://git-scm.com/docs/git-config/#Documentation/git-config.txt-colorbranchltslotgt

color.branch.<slot>

自定义分支颜色。<slot> 是以下值之一:current(当前分支),local(本地分支),remote(位于 refs/remotes/ 的远程跟踪分支),upstream(上游跟踪分支),plain(其他引用)。

你可能希望对color.branch.remote执行相同的操作(例如,对 git branch -a 命令的输出进行颜色设置)。


5

您可以编辑.gitconfig文件并写入以下内容:

[color "branch"]
    current = yellow
    local = yellow
    remote = yellow

您也可以使用类似以下命令来实现此目的:

git config --global color.branch ...

了解更多相关信息,请参考:https://git-scm.com/book/zh/v2/Git-配置-Git


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接