gpt4 book ai didi

git - 如何着色 git push 输出

转载 作者:太空狗 更新时间:2023-10-29 13:59:15 25 4
gpt4 key购买 nike

在错误情况下,是否可以创建一个 git 别名来为 git push 命令的输出着色?

我有一个可以记录日志的,但我无法修改它以使用推送。

git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%C(62)\\ [%cn]\\ %ce" --decorate

错误信息示例:

"error: failed to push some refs to 'https://github.com/user/projectname.git'"

最佳答案

推送应该打印什么?

push 将“推送”代码的结果打印到服务器。您可以使用服务器端 Hook 向用户发送彩色消息。

pre-receive hook

#!/bin/sh

# Output colors
red='\033[0;31m';
green='\033[0;32m';
yellow='\033[0;33m';
default='\033[0;m';

# personal touch :-)
echo "${red}"
echo " "
echo " |ZZzzz "
echo " | "
echo " | "
echo " |ZZzzz /^\ |ZZzzz "
echo " | |~~~| | "
echo " | |- -| / \ "
echo " /^\ |[]+ | |^^^| "
echo " |^^^^^^^| | +[]| | | "
echo " | +[]|/\/\/\/\^/\/\/\/\/|^^^^^^^| "
echo " |+[]+ |~~~~~~~~~~~~~~~~~~| +[]| "
echo " | | [] /^\ [] |+[]+ | "
echo " | +[]+| [] || || [] | +[]+| "
echo " |[]+ | || || |[]+ | "
echo " |_______|------------------|_______| "
echo " "
echo " "
echo " ${green}You have just committed code ${red} "
echo " Your code ${yellow}is bad.!!! "
echo " ${red} Do not ever commit again "
echo " "
echo "${default}"

关于git - 如何着色 git push 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36841667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com