Skip to content

Instantly share code, notes, and snippets.

@sueharaluke
Last active November 16, 2021 07:26
Show Gist options
  • Save sueharaluke/9cd96f16829d296c42adea057a9e0f5f to your computer and use it in GitHub Desktop.
Save sueharaluke/9cd96f16829d296c42adea057a9e0f5f to your computer and use it in GitHub Desktop.
Zip files changes between commits

Zip files changes between commits

It also ignores delete files.

Only the latest commit

git archive --format=zip HEAD `git diff --diff-filter=d HEAD^ HEAD --name-only` > diff.zip

Between two SHA

git archive --format=zip HEAD `git diff --diff-filter=d SHA1 SHA2 --name-only` > diff.zip

Only tested on MacOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment