9

我想不通。为什么这些行为不同:

(shell-command "git log")
(shell-command "git shortlog")

第一个按预期工作:返回 0 并将内容打印到 shell 输出缓冲区。第二个返回 0 但什么也不打印。这是为什么?

  1. 两者都可以完美地git log工作git shortlogansi-term
  2. 两者都git log发出git shortlog警告,但仍在工作shell
4

1 回答 1

8

man git-shortlog

If no revisions are passed on the command line and either standard input is not a terminal or there is no current branch, git shortlog will output a summary of the log read from standard input, without reference to the current repository.

You must explicitly provide reference to work in your case,

Use, git shortlog HEAD instead.

于 2017-03-27T09:17:39.347 回答