我之前弄过,把本地的 git 修改代码作为更新文件
#!/bin/bash
# Target directory
#
https://stackoverflow.com/questions/31340933/copy-all-files-changed-in-last-commithead0=${1:-head~0}
head1=${2:-head~1}
TARGET=${3:-publishTemp}
echo "Finding and copying files and folders to $TARGET"
for i in $(git diff --name-only $head0 $head1)
do
# First create the target directory, if it doesn't exist.
mkdir -p "$TARGET/$(dirname $i)"
# Then copy over the file.
cp "$i" "$TARGET/$i"
done
echo "Files copied to target directory";