Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
Created December 5, 2015 09:32
Show Gist options
  • Save nishinoshake/b97b8ffcac7d5bd5f7ff to your computer and use it in GitHub Desktop.
Save nishinoshake/b97b8ffcac7d5bd5f7ff to your computer and use it in GitHub Desktop.
gitのコミット差分をアーカイブ
#!/bin/sh
if [ "$2" = "" ]; then
git archive --format=zip --prefix=archive/ HEAD `git diff --name-only HEAD $1` | tar xf - -C ~/Downloads/
else
git archive --format=zip --prefix=archive/ $1 `git diff --name-only $1 $2` | tar xf - -C ~/Downloads/
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment