Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Created April 2, 2012 14:56
Show Gist options
  • Save betweenbrain/2284129 to your computer and use it in GitHub Desktop.
Save betweenbrain/2284129 to your computer and use it in GitHub Desktop.
Git command to export only changed files between two commits
git archive --output=file.zip HEAD $(git diff --name-only SHA1 SHA2)
@borgle
Copy link

borgle commented Jul 11, 2016

git diff --name-only SHA1..SHA2 | xargs tar -zcf update.tar.gz

or

tar -zcf update.tar.gz git diff --name-only SHA1..SHA2

@nebadom
Copy link

nebadom commented Jun 19, 2017

For some weird reason, when I try tar -zcf (attempting to generate a gzipped version) it just doesn't save all the affected files. However, if I use tar -rf it does work as intended.

Any idea why that is ocurring?

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