git-checkout – 什么控制git checkout反馈?

有时git checkout命令会提供进度反馈:

$git checkout develop
Checking out files: 100% (10779/10779), done.
Switched to branch 'develop'

有时它不会,(非常下一个命令行,相同的repo上下文):

$git checkout master
Switched to branch 'master'

这不是因为分支是相同的,因为切换回下一个命令会显示此反馈:

$git checkout develop
Checking out files: 47% (5067/10779), done.
Switched to branch 'develop'

这也适用于小型回购.我有一个只有13个文件的repo,当我在分支中添加一个文件并使用checkout来回切换时,我得不到任何反馈.它是某种“这需要很长时间,开始显示反馈”计时器?

我搜索过(谷歌,Stackoverflow),但没有发现任何具体的内容.我确实找到了一些补丁文档,其中显示了一个–verbose标志,用于检查,强制反馈始终发生,但我无法找到解释为什么反馈只在没有补丁的情况下才会发生.同样的注意事项指出,只有当isatty()返回true时才会发生反馈,但这里没有相关性,因为上面的所有命令都被输入到同一个bash窗口中,这可能是错误的.

我正在使用git版本1.8.1.msysgit.1(从git-scm.com下载为1.8.1.3),据我所知,它没有–verbose补丁.

最佳答案 此结帐输出现在应该与Git 2.7(Nov./Dec.2015)更加一致

Edmundo Carmona Antoranz (eantoranz),见commit 870ebdb(2015年11月1日).
(于2015年11月5日commit 6a38bd6 commit 6a38bd6合并)

git checkout” did not follow the usual “--[no-]progress” convention and implemented only “--quiet” that is essentially a superset of “--no-progress“.
Extend the command to support the usual “--[no-]progress“.

git checkout doc现在显示:

--[no-]progress::

Progress status is reported on the standard error stream by default when it is attached to a terminal, unless --quiet is specified.
This flag enables progress reporting even if not attached to a terminal, regardless of --quiet.

checkout: add --progress option

Under normal circumstances, and like other git commands, git checkout will write progress info to stderr if attached to a terminal.
This option allows progress to be forced even if not using a terminal.
Also, progress can be skipped if using option --no-progress.

点赞