当我做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/