Skip to content

Instantly share code, notes, and snippets.

@harieamjari
Created April 12, 2024 10:17
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 harieamjari/f45e8e7652267b11cd2c4ad55c22b7cb to your computer and use it in GitHub Desktop.
Save harieamjari/f45e8e7652267b11cd2c4ad55c22b7cb to your computer and use it in GitHub Desktop.
generate individual patch
#set -e
#usage old_directory new_directory
modfiles=$(find ${2} -type f -exec grep -Iq . {} \; -print)
#origfiles=${modfiles//$2/$1}
rm patchfiles -rf
mkdir patchfiles
echo $modfiles
for file in $modfiles; do
pfile=patchfiles/$(echo $file | sed -e's@'${2}'/@@' -e 's@/@.@g').patch;
echo $pfile ;
(
echo "diff -uNr ${file//$2/$1} $file"
diff -uNr ${file//$2/$1} $file
) | tee $pfile
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment