如何在Zsh上显示git颜色?

Mig*_*ore 32 git zsh

我最近开始使用Zsh作为我的默认shell.我在git的喜欢的一件事是颜色,例如,git statusgit diff曾经有过的颜色(红色绿色新增和删除).

现在有了Zsh,它全是白色(默认颜色).如何在Zsh中的git输出上添加颜色?谢谢.

小智 62

git config --global color.diff auto
git config --global color.status auto


Ped*_*nto 14

Migore,

.gitconfig的设置如下:

[color]
  diff = auto
  status = auto
  branch = auto
[color "status"]
  changed = yellow
  added = green
  untracked = red
Run Code Online (Sandbox Code Playgroud)

  • 如果有人想把它放在哪里,它应该在你的主目录中的 ~/.gitconfig 文件中。至少在我的情况下。 (2认同)

Mig*_*ore 11

我正在搜索zsh方面的解决方案.但事实证明,git有一个解决方案.只需将其添加到.gitconfig文件即可

[color]
    ui = auto
Run Code Online (Sandbox Code Playgroud)