我是一名Git的新手。
我的问题是,我需要通过一个在Windows上运行的shell脚本来将Git的Push命令保存到输出文件中。
到目前为止,我有类似于以下的东西:
echo -e "\n6) ${GREEN}Starting Push.${NC}"
git push -v >> logs/logPush.log
if grep -q -w -i "Rejected" logs/logPush.log ;
then
echo "${RED}A conflict has been detected. Exiting.${NC}"
read
exit
else
:
fi
但它总是生成一个空文件。拉取操作运行良好...有人知道如何使输出文件接收终端上出现的所有信息吗?
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To ssh:repository
42be914..ead1f82 master -> master
updating local tracking ref 'refs/remotes/origin/master'