Created
June 19, 2018 15:05
-
-
Save solbisio/ad1e31b8bb5318dd87d28a8577c62445 to your computer and use it in GitHub Desktop.
Revisions
-
solbisio created this gist
Jun 19, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ #!/bin/bash echo "Export Git Diff" read -p "Export Start Commit ID: " input1 read -p "Export End Commit ID: " input2 commitIdStart="${input1}" if [ "${input2}" == "" ]; then commitIdEnd="HEAD" else commitIdEnd="${input2}" fi echo "Start ID: $commitIdStart" echo "End ID: $commitIdEnd" #Create Export Folder now=$(date +%Y%m%d_%H%M%S) #echo "Current date: $now" dirpath="GitExport/$now" echo "Export Path:$dirpath" mkdir -p $dirpath #Get File List files=$(git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commitIdStart $commitIdEnd); #echo $files; for item in $files ; do echo "Copy: $item" ## For Linux (Todo Test) newdir=$(dirname $item) mkdir -p "$dirpath/$newdir" cp "$item" "$dirpath/$item" # For Mac OS # ditto "$item" "$dirpath/$item" done