Last active
November 22, 2018 03:55
-
-
Save kaminaly/5670536 to your computer and use it in GitHub Desktop.
gitで差分ファイルを抽出する ref: http://qiita.com/kaminaly/items/28f9cb4e680deb700833
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
git archive --format=zip --prefix=root/ HEAD `git diff --diff-filter=d --name-only HEAD^ HEAD` -o archive.zip |
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
function git_diff_archive() | |
{ | |
local diff="" | |
local h="HEAD" | |
if [ $# -eq 1 ]; then | |
if expr "$1" : '[0-9]*$' > /dev/null ; then | |
diff="HEAD~${1} HEAD" | |
else | |
diff="${1} HEAD" | |
fi | |
elif [ $# -eq 2 ]; then | |
diff="${2} ${1}" | |
h=$1 | |
fi | |
if [ "$diff" != "" ]; then | |
diff="git diff --diff-filter=d --name-only ${diff}" | |
fi | |
git archive --format=zip --prefix=root/ $h `eval $diff` -o archive.zip | |
} |
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
git_diff_archive |
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
git_diff_archive 数値 |
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
git_diff_archive コミット識別子 |
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
git_diff_archive コミット識別子1 コミット識別子2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment