当我这样做时git status
,我的显示屏上会出现漂亮的漂亮颜色。
但是git push/pull/fetch
只是单色无聊
我将:git config color.ui always
设置为开,但是除了状态外,我什么也看不到。
我想念什么吗?
如果某件事被拒绝,我希望看到一条红色消息弹出。也许有一种方法可以将git输出包装在颜色处理器中?
https://git-scm.com/book/zh/v2/Customizing-Git-Git-Configuration似乎没有谈论推/拉
即我想在这里用红色将错误行涂成红色:
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.
Run Code Online (Sandbox Code Playgroud)
我猜可能有可能以某种方式将其包装在脚本中,如果有一行error:
将使其变为红色?我知道有一个颜色专家“东西”在那里做些东西到专家输出。
在push.h,pull.h或fetch.h中查找字符串颜色,表明它们不使用git的着色功能。
但是,如果您要为git错误着色,可以使用另一个堆栈溢出问题中的此解决方案:如何为git错误,警告和致命消息着色?