Last active
April 22, 2020 14:12
-
-
Save emisjerry/4cdd266178be124eee2c71a3ef530f77 to your computer and use it in GitHub Desktop.
git-export.bat: 產生Commit的檔案清單與相對路徑的壓縮檔;Windows適用
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 | |
chcp 65001 | |
echo param1=%1, param2=%2 | |
if "%1"=="" goto USAGE | |
del export.7z | |
if "%2%"=="" goto ONE_ARGUMENT | |
echo ***git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT %1 %2 | |
for /f "usebackq tokens=*" %%A in (`git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT %1 %2`) do 7z a -sccUTF-8 export.7z "%%A" | |
git diff --name-status %1 %2 > export.txt | |
goto OPEN | |
:ONE_ARGUMENT | |
for /f "usebackq tokens=*" %%A in (`git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT %1~1 %1`) do 7z a -sccUTF-8 export.7z "%%A" | |
git diff --name-status %1~1 %1 > export.txt | |
goto OPEN | |
:USAGE | |
echo Usage: git-export First-Commit-SHA Second-Commit-SHA | |
echo Please change directory to a Git working folder first in Command Prompt. | |
:OPEN | |
start "7z" export.7z | |
start "txt" export.txt | |
:END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment