问题
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