我想将 git clone 输出打印到文件中。
该文件应具有与终止进程后控制台输出相同的内容。
例如
Cloning into 'repo'...
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 8 (delta 1), reused 0 (delta 0)
Receiving objects: 100% (8/8), done.
Resolving deltas: 100% (1/1), done.
Checking connectivity... done
这将是所需的输出。
不幸的是,我得到了单一进度状态的后续行:
Cloning into 'repo'...
remote: Counting objects: 8, done.[K
remote: Compressing objects: 16% (1/6) [K
remote: Compressing objects: 33% (2/6) [K
remote: Compressing objects: 50% (3/6) [K
remote: Compressing objects: 66% (4/6) [K
remote: Compressing objects: 83% (5/6) [K
remote: Compressing objects: 100% (6/6) [K
remote: Compressing objects: 100% (6/6), done.[K
remote: Total 8 (delta 1), reused 0 (delta 0)[K
Receiving objects: 12% (1/8)
Receiving objects: 25% (2/8)
Receiving objects: 37% (3/8)
Receiving objects: 50% (4/8)
Receiving objects: 62% (5/8)
Receiving objects: 75% (6/8)
Receiving objects: 87% (7/8)
Receiving objects: 100% (8/8)
Receiving objects: 100% (8/8), done.
Resolving deltas: 0% (0/1)
Resolving deltas: 100% (1/1)
Resolving deltas: 100% (1/1), done.
Checking connectivity... done
有办法解决吗?
最佳答案
如果您不关心进度,您可以重定向输出:
git clone -q
--quiet
-q
Operate quietly. Progress is not reported to the standard error stream.
This flag is also passed to the `rsync' command when given.
3 年后更新:克隆存储库及其子模块时,此选项效果不佳。
Git 2.14.x/2.15(2017 年第 3 季度)已修复此问题
参见commit 03c004c (2017 年 8 月 3 日)作者:Brandon Williams (mbrandonw
) .
(由 Junio C Hamano -- gitster
-- 于 commit cd2a952 merge ,2017 年 8 月 22 日)
"
git clone --recurse-submodules --quiet
" did not pass the quiet option down to submodules.
关于Git:将 'git clone' 输出打印到文件中并删除进度子状态行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23865894/