Last active
December 13, 2018 13:21
-
-
Save svdmitrij/66170c6b9714bf0a7e60 to your computer and use it in GitHub Desktop.
Create archive from diff 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
#!/usr/bin/env bash | |
firstCommit=$1 | |
secondCommit=$2 | |
if [[ -z $firstCommit || -z secondCommit ]]; then | |
echo "Usage: $0 first_commit_sha second_commit_sha" | |
fi | |
git archive --format=tar.gz -o changes.tgz "$secondCommit" $(git diff --name-only "$firstCommit") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install: put the script into ~/bin (or any directory in $PATH),
chmod +x ~/bin/git_archive.sh
Usage:
git_archive.sh first_sha second_sha
second_sha - newer commit
first_sha - older commit
The archive is
changes.tgz
in current directory.