git - git pull/push 是否支持颜色

标签 git bash

当我做git status时我的显示屏上显示出漂亮的颜色。

但是 git push/pull/fetch只是单色无聊

我有:git config color.ui always设置为打开,但似乎除了状态之外我没有得到任何颜色。

我错过了什么吗?

如果某些内容被拒绝,我希望看到一条红色消息 pop 。也许有办法将 git 输出包装在颜色处理器中?

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration似乎没有谈论推/pull

即我想在这里将错误行涂成红色:

To ssh://<REPO ADDRESS>
 ! [rejected]        develop -> develop (fetch first)
error: failed to push some refs to 'ssh://<REPO ADDRESS>'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

我想也许可以将它以某种方式包装在脚本中,如果一行有 error:它会让它变红吗?我知道有一个 color Maven“东西”可以对 Maven 输出做一些事情。

最佳答案

在push.h、pull.h或fetch.h中查找字符串color,发现它们没有使用git的着色功能。

但是如果你想给 git 错误着色,你可以使用这个 solution来自另一个堆栈溢出问题:How to colorify git errors, warnings and fatal messages?

关于git - git pull/push 是否支持颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32531399/

相关文章:

git - 无法提交到一个空的 git 仓库

git - 当一个(未 merge 的)Git 分支不再事件时删除它?

公共(public)仓库上的 git 权限错误?

git - 如何将所有新的上游分支与我的分支同步?

c++ - 用于编译和运行多个服务器和客户端的 Bash 脚本 c

BASH:我如何像 watch 命令一样输出

git - 文件缺少 TortoiseGit 上下文选项

arrays - 如何在shell中找到数组的长度?

计算下一个 ASCII 字符的 Linux 命令或 Bash 语法

bash - 从命令行/bash 测试 Matlab 许可证是否正在使用