Git 日志别名不起作用

Git Log Alias not working

所以我尝试设置一个别名,它基本上会为任何给定的提交提供 "git status" 的等价物。

git log --name-status --diff-filter="ACDMRT" -1 -U HEAD ... 有效!

所以我这样设置:

git config --global alias.inf 'log --name-status --diff-filter="ACDMRT" -1 -U '

然后我 运行 是这样的:

git inf HEAD

然而,当我 运行 命令时它出错了:

fatal: ambiguous argument '': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'

有人知道为什么该命令可以直接使用而不是作为别名使用吗?

更新:我从末尾删除了 -U,现在可以像这样执行: git inf -U HEAD 哪个有效,但我不想输入 -U...所以问题仍然存在...

我通过删除别名结尾的尾随 space 使其正常工作。

git config --global alias.inf 'log --name-status --diff-filter="ACDMRT" -1 -U'

希望对你有用。