“gitbranch-vv”改变远程分支的颜色

Moe*_*ald 6 git

当调用git branch -vv显示本地到远程分支的映射时,远程分支显示为蓝色(在命令行上工作时很难阅读)。如何将远程分支的颜色更改为黄色?

我还发现这个堆栈溢出问题尚未得到解答。

小智 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(其他 refs)之一。

您可能希望对(例如,color.branch.remote对于 的输出)执行相同的操作。git branch -a


MFn*_*Fnx 5

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

[color "branch"]
    current = yellow
    local = yellow
    remote = yellow
Run Code Online (Sandbox Code Playgroud)

这也可以通过以下命令来实现:

git config --global color.branch ...
Run Code Online (Sandbox Code Playgroud)

有关这些的更多信息:https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration