Skip to content

Instantly share code, notes, and snippets.

@jirolabo
Created May 30, 2018 13:00
Show Gist options
  • Save jirolabo/b311788be981ab7d412711c15837b858 to your computer and use it in GitHub Desktop.
Save jirolabo/b311788be981ab7d412711c15837b858 to your computer and use it in GitHub Desktop.
SourceTree(Git)から差分ファイルを抽出してzipに圧縮
if "%2" EQU "" (
set PARAM1=HEAD
set PARAM2=%1
) else (
set PARAM1=%1
set PARAM2=%2
)
chcp 65001
setlocal enabledelayedexpansion
set RET_DIR=
for /F "usebackq" %%i in (`"C:\Program Files\Git\bin\git" diff --name-only %PARAM1% %PARAM2%`) do (
set RET_DIR=!RET_DIR! "%%i"
)
"C:\Program Files\Git\bin\git" archive --format=zip --prefix=archive/ %PARAM1% %RET_DIR% -o archive.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment