Skip to content

Instantly share code, notes, and snippets.

@yzorg
Created March 30, 2023 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yzorg/fdc7c5964973dee9856f273ad90ad7d2 to your computer and use it in GitHub Desktop.
Save yzorg/fdc7c5964973dee9856f273ad90ad7d2 to your computer and use it in GitHub Desktop.
copy GIT changed files to new folder
#!/bin/sh
# by ahmed on SO, https://stackoverflow.com/a/74122351/195755, NOT by @yzorg
FILES=`git ls-files --modified`
export_dir="place your export dir"
for x in $FILES
do
prev_dir=$PWD
folder=$(dirname $x)
echo "Exporting to..." $export_dir/$x
cp $prev_dir/$x $export_dir/$x
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment