zip archive.zip $(git diff-tree --no-commit-id --name-only -r latest-commit-id)
Reference: https://stackoverflow.com/a/42971972/2229148
sometimes you need all the files that were updated so you can patch an external app which doesnt uses same git project or many other scenarios in which we need a zip or tar of those files. Use the above command to do so
There is a smarter way also, if you want all the changes from last 5 commits, use the command like this:
zip archive.zip $(git diff-tree --no-commit-id --name-only -r HEAD~5 HEAD)
Leave a Reply