为什么 git 分支和标记注释在 git 日志中消失,如果你将它传递给更多?

Why do git branch and tag annotations in git log disappear if you pipe it to more?

git 版本 2.20.1

(base) piadmin@pi-spec1:~/pi$ git log
commit 2851703321fd8d026c51621dd9553f2cec92a6c0 (HEAD -> PI_InFactory, tag: PI_shipped_20220310, origin/PI_InFactory)
Author: David <dac@me.ca>
Date:   Thu Mar 10 10:08:34 2022 -0500

    Fix classes to match PI, on commented line, for agile customer support


(base) piadmin@pi-spec1:~/pi$ git log | more -20
commit 2851703321fd8d026c51621dd9553f2cec92a6c0
Author: David <dac@me.ca>
Date:   Thu Mar 10 10:08:34 2022 -0500

    Fix classes to match PI, on commented line, for agile customer support

注意当我使用“更多”时“提交”行缺少什么吗?

澄清编辑:当我问“为什么”时,那是因为在我几十年的 linux 经验中,我从未见过在将某些东西传送到 more 时输出发生变化(除了颜色丢失) .在我看来,这是命令行 *nix 和管道架构的基本概念,这不可能发生,所以我想我的意思是“如何?”和“为什么?”。

在@LeonardoDagnino 的回答后,我看到如果我输入 git log --decorate=auto,我应该期待这种行为,但我没有添加这个参数,帮助说默认选项应该是 'short' 反正

手册页 git-log(1) (since version 3.33) 解释了 --decorate 的默认行为是 auto,它的作用会改变您是否 运行是否在终端中:

   --no-decorate, --decorate[=short|full|auto|no]
       <...>
       If auto is specified, then if the output is going to a terminal, the ref
       names are shown as if short were given, otherwise no ref names are shown.
       <...>
       Default to configuration value of log.decorate if configured, otherwise,
       auto.
       

当您 运行 程序在其输出上带有管道时,输出将成为管道本身,而不是终端,因此不会显示引用名称。