Created
May 23, 2019 22:52
-
-
Save fernandofig/539652747da79681647af98dc7e8e248 to your computer and use it in GitHub Desktop.
Script to be used with SourceTree to create a zip archive of files changed on a given (single) commit
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
@ECHO OFF | |
SET "PATH=%PATH%;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin" | |
cd "%~2" | |
bash "C:\Program Files\Git\usr\bin\packChanges.sh" %1 | |
EXIT 0 |
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
ISMERGE=0 | |
gitismerge () { | |
local sha="$1" | |
msha=$(git rev-list -1 --merges ${sha}~1..${sha}) | |
if [ -z "$msha" ]; then | |
ISMERGE=0 | |
else | |
ISMERGE=1 | |
fi | |
} | |
gitismerge "$1" | |
if [ "$ISMERGE" = "1" ]; then | |
GITDIFF=`git diff --no-commit-id --name-only --diff-filter=ACMRT -r $1^ $1` | |
else | |
GITDIFF=`git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT -r $1` | |
fi | |
#echo $GITDIFF > saida.txt | |
git archive -o changes.zip $1 $GITDIFF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment