So, the recipient of this archive doesn't have the repo but does have the content of some commit, and you're sending replacements he can untar onto that?
It seems git archive's --output
option on windows fails at telling the compressor about the redirection, which duly refuses to write compressed output to what it thinks is a terminal, but that's easily worked around:
git archive -o update-old-new.tgz newcommit \
$(git diff --name-only --diff-filter=AM oldcommit..newcommit) | cat
That | cat
at the end is the workaround.
I'd forgotten about archive
, but using it means you don't have to checkout $newcommit first so this is much better than the earlier checkout;diff|tar
combo.
Still, this can't handle an update large enough to blow command-line limits, or spaces or other annoying characters in the pathnames. The fallback is
git checkout newversion
git diff --name-only --diff-filter=AM oldversion.. \
| tar Tczf - update-old-new.tgz