I use this answer in this case which tells me
tar czf changed-files.tar.gz `git diff --name-only [diff options]`
For example, to create an archive containing files modified in the last four versions, I would do
tar czf changed-files.tar.gz `git diff --name-only HEAD~4..`
This assumes - of course - that HEAD~4
does exist.
source share