Created
May 30, 2018 17:39
-
-
Save sawwd/f58367e34709b2aba99b908c24eb2de7 to your computer and use it in GitHub Desktop.
Git: archive only the changes between two commits.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IFS=$'\n' | |
files=($(git diff --name-only $1 $2)) | |
git archive -o $3 $2 "${files[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the working directory:
Running
git log --pretty=oneline
Will output something like:
Type
q
to exit from git log.Let's say we want to make an archive only with the file changes between
359592
(first commit SHA1) andddd9b0d
(last commit SHA1) namedlast-changes.zip
We will run:
./gitdiffzip.sh 359592 ddd9b0d last-changes.zip