git space between pretty format placeholders

有些话、适合烂在心里 提交于 2019-12-13 03:57:19

问题


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:

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!


回答1:


Since you're not quoting the argument to --pretty, you have to escape the space, like:

git log --pretty=format:{\"author\":\"%aE\ <%aD>\"}

Otherwise <%aD>\"} will be interpreted as next argument.

Edit: Or instead try to quote the whole argument, e.g.

git log --pretty="format:{\"author\":\"%aE <%aD>\"}"

Edit2: The escape char for cmd seems to be ^, so try:

git log --pretty=format:{\"author\":\"%aE^ <%aD>\"}


来源:https://stackoverflow.com/questions/53044157/git-space-between-pretty-format-placeholders

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!