Created
June 28, 2017 17:54
-
-
Save riterrani/76b795f3dd39597e5ba42b1fb3f61e4c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Target directory | |
TARGET=$3 | |
echo "Finding and copying files and folders to $TARGET" | |
for i in $(git diff --name-only $1 $2) | |
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"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment