如何在git blame时抑制--show-name(filename)选项?

时间:2015-11-09 02:32:35

标签: git

-f, --show-name
       Show the filename in the original commit. By default the filename is shown if there is any line that came from a file with a different name, due to rename detection.

但是--show-name=off不起作用。

error: option `show-name' takes no value
usage: git blame [<options>] [<rev-opts>] [<rev>] [--] <file>

如何从输出中隐藏详细文件名?

3 个答案:

答案 0 :(得分:6)

此选项在commit eb93b724(git 1.4.4,2006年10月)中引入

  

新选项使得命令的本机输出格式即使在其历史记录中没有重命名时也显示文件名,以使Porcelains更容易解析其输出。

这意味着:

  • 不使用此选项是让它&#34; off&#34;
  • 的方法
  • 当历史记录中存在重命名时,文件名始终显示。

正如Edouard Poor的答案所述,您可以使用git blame -c,它会强制使用与git-annotate相同的输出模式。

答案 1 :(得分:4)

git annotate在其输出中不包含此信息。 (如果您尝试激活它,它会默默忽略--show-name选项。)

答案 2 :(得分:3)

正如Matt McHenry所说,git annotate没有显示文件名。

诀窍是git blame采用-c标志强制输出符合annotate子命令,这导致没有文件名。

相关问题