我尝试在 GitBash、Windows 上运行 git hist cmd,但收到以下错误
fatal: option '--graph' must come before non-option arguments
在窗口 PowerShell 上,我输入:
git config --global alias.hist log --pretty=format: '%h %ad | %s%d [%an]' --graph --date= short"
但仍然遇到同样的错误。
请我知道为什么以及如何避免这个错误?
只需先移动
--graph
/ --date
选项即可。
我刚刚通过常规 CMD 进行了测试(不需要 PowerShell):
git config --global alias.hist "log --graph --date=short --pretty=format:'%h %ad | %s%d [%an]'"
然后 git hist 就可以正常工作了。
注意
format:
和 '%h...'
之间缺少空格
对我来说这也解决了问题。谢
删除格式后的空格为我解决了这个错误。我在最后留下了图表和日期选项。 – 穆里 2023 年 6 月 7 日 20:11