Created
December 3, 2014 18:21
-
-
Save berlotto/42344c19a8f81d6d8f89 to your computer and use it in GitHub Desktop.
getgitdiff - Script that archive the files from range of commits in git repo
This file contains hidden or 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 | |
| VERSION="0.1" | |
| IDENT="latest" | |
| if [ $# -lt 2 ] ; then | |
| printf "getgidiff - created by [email protected]\n" | |
| printf "Version:$VERSION\n" | |
| printf "Usage:\n\tgetgitdiff {earlier-commit} {some-commit} [package-identification]\n" | |
| exit 1; | |
| fi | |
| NOW="$(date +'%d-%m-%Y-%H-%M-%S')" | |
| if [ -z "$3" ] ; then | |
| IDENT="latest-$NOW" | |
| else | |
| IDENT="$3-$NOW" | |
| fi | |
| git diff --name-only $1 $2 | xargs -d'\n' git archive -o ../$IDENT.zip $2 | |
| echo "Done: file ../$IDENT.zip created." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment