I have a batch file that tries to run the following:
FOR /F "tokens=1" %%G IN ('git show --pretty="format:" --name-only 54173344ab18a7d8e9ff2614cca62b671c8c7e2a') DO echo %%G
Which results in a git error "fatal: Invalid object name 'format'."
However, if I just put the command in a batch file, I get the output that I expect.
git show
It produces:
Files/MyFiles/header.html
Files/MyFiles/foo.html
The problem is with quotation marks around "format:".
I tried to run away from them using "", but to no avail. I also tried ^. I tried using the usebackq parameter.
This loop also works if you take out the argument --pretty = "format:", but then I get a bunch of added text.
source
share