git diff --name-only and spaces #22586
-
I had to recover the set of files modified during a specific commit as follows: COMMIT=28cd71c36323b8ff4ff01cfabed0a1764d4744c3 git archive -o changed.zip If there are spaces in file names the above does not work. The question is, how can deal correctly with spaces in names returned by git diff. There are several options involving sed/xargs, but I would like to have a feedback from you experts. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Apologies, it was easy: git archive -o changed.zip |
Beta Was this translation helpful? Give feedback.
-
Hi @eruffaldi, Thank you for sharing your solution! We’re looking forward to seeing you around! Best, Andrea |
Beta Was this translation helpful? Give feedback.
Apologies, it was easy:
git archive -o changed.zip$COMMIT $ (git diff --name-only $COMMIT $COMMIT^ | sed ‘s/.*/"&"/’)