[英]git space between pretty format placeholders
For some reason ( this reason ) I will probably have to run a git command like this: 由于某种原因( 这个原因 ),我可能必须运行这样的git命令:
git log --pretty=format:{\"author\":\"%aE <%aD>\"}
but it doesn't work and I obtain this error information: 但它不起作用,我获得以下错误信息:
fatal: ambiguous argument '<%aD>"}': unknown revision or path not in
the working tree.
fatal: ambiguous argument '<%aD>"}': unknown revision or path not in
the working tree.
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!
谢谢!
Since you're not quoting the argument to --pretty
, you have to escape the space, like: 由于您没有引用
--pretty
的参数, --pretty
必须转义空格,例如:
git log --pretty=format:{\"author\":\"%aE\ <%aD>\"}
Otherwise <%aD>\\"}
will be interpreted as next argument. 否则
<%aD>\\"}
将被解释为下一个参数。
Edit: Or instead try to quote the whole argument, eg 编辑:或者改为尝试引用整个参数,例如
git log --pretty="format:{\"author\":\"%aE <%aD>\"}"
Edit2: The escape char for cmd
seems to be ^
, so try: Edit2:
cmd
的转义字符似乎是^
,所以请尝试:
git log --pretty=format:{\"author\":\"%aE^ <%aD>\"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.