git - Emacs:为什么 shell 命令 "git log"有效,但 "git shortlog"无效?

标签 git shell emacs elisp

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

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

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

还有

  1. git loggit shortlog 都可以在 ansi-term 中完美运行
  2. git loggit shortlog 都会发出警告,但仍然可以在 shell 中工作

最佳答案

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.

您必须在您的案例中明确提供工作引用,

改用 git shortlog HEAD

关于git - Emacs:为什么 shell 命令 "git log"有效,但 "git shortlog"无效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19741957/

相关文章:

Github:对不相关的小改动单独 pull 请求?

Git 似乎卡在我的旧帐户上

linux - 将 bash 输出重定向到存储在变量中的路径

linux - Bash while 循环使用包含本地 $variable 的远程 grep

python - 使用 Org–Babel 控制缩进

emacs + clojure 模式 : add multiple hooks

emacs - 在 emacs 中运行 lynx 文本 Web 浏览器

Git clean 过滤器 - 检索原始行,git smudge 但不是原始行

git - 执行 Git 别名时显示完整命令?

bash - 用于在 bash printf 中着色的 ANSI 转义码