漂亮格式占位符之间的git空间 [英] git space between pretty format placeholders
问题描述
由于某些原因(此原因),我可能会有运行这样的git命令:
For some reason (this reason) I will probably have to run a git command like this:
git log --pretty=format:{\"author\":\"%aE <%aD>\"}
但它不起作用,我获取以下错误信息:
but it doesn't work and I obtain this error information:
致命:模棱两可的参数'<%aD>}':未知修订或路径不在
工作树中。
,但是在空格不起作用的情况下使用同一命令:
but the same command whithout the space works well:
git log --pretty=format:{\"author\":\"%aE<%aD>\"}
你知道吗
谢谢!
Do you know how to fix this or how to insert a space "programmatically" with another placeholder? Thanks!
推荐答案
自从您以来,如何解决此问题或如何以编程方式与其他占位符插入空格?如果不引用-pretty
的参数,则必须转义空格,例如:
Since you're not quoting the argument to --pretty
, you have to escape the space, like:
git log --pretty=format:{\"author\":\"%aE\ <%aD>\"}
否则<%aD> \ }
将被解释为下一个参数。
Otherwise <%aD>\"}
will be interpreted as next argument.
编辑:或者尝试引用整个参数,例如
Or instead try to quote the whole argument, e.g.
git log --pretty="format:{\"author\":\"%aE <%aD>\"}"
Edit2: cmd
的转义字符似乎是 ^
,因此请尝试:
The escape char for cmd
seems to be ^
, so try:
git log --pretty=format:{\"author\":\"%aE^ <%aD>\"}
这篇关于漂亮格式占位符之间的git空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!