Creating and applying a patch with diff and patch


this post describes to save and apply changes to an source file.

Let us assume you want to alter the file src/tuwien/auto/calimero/server/ and from the changes you want to create a patch.

First make a copy of the origin file.

michael@debdev ~# cp src/tuwien/auto/calimero/server/ src/tuwien/auto/calimero/server/

Then make some changes to the file and create the patch. Note the options -Nar also work for directories recursive. For a single file -u3 is sufficient.

michael@debdev ~# vi src/tuwien/auto/calimero/server/
michael@debdev ~# diff -Nar -u3 src/tuwien/auto/calimero/server/ src/tuwien/auto/calimero/server/ > myPatch.txt

Restore the origin file and apply the patch

michael@debdev ~# patch src/tuwien/auto/calimero/server/ < myPatch.txt


Advertisment to support

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress