Keeping the file structure, like git-archive
Courtesy of @Charles Duffy https://stackoverflow.com/users/14122/charles-duffy
Thanks to @Viperet answer. Below is to insert a pause if you have a very long list files to be archived. Xargs will run the same command multiple time with split arguments hence it will always produce the archived zip with the last split arguments. To correct that, a quick workaround is to insert a pause in between.
Again, it's a courtesy from Charles Duffy. XARGS Long Arguments and Pause Between Commands
Updated command:
git diff --name-only -z --diff-filter=ACMRT release..HEAD | xargs -0 bash -c '"$@"; sleep 10' _ git archive -o update.tar.gz HEAD
Hope it helps others as well.
Thank you,
Hatjhie