There is a program called diff that can display the difference between two files or directories or even an entire directory structure.
You can use the output of this diff program to create patch files. You can then use a patch file to apply these changes to code.
Example.
old/foo.php
<?php
echo "hello world";
new/foo.php
<?php
echo "Hello World";
Creating a patch:
diff -rupN old/ new/ > foo.patch
foo.patch
diff -rupN old/foo.php new/foo.php
--- old/foo.php 2011-08-15 11:10:14.000000000 +1000
+++ new/foo.php 2011-08-15 11:10:43.000000000 +1000
@@ -1,3 +1,3 @@
<?php
-echo "hello world";
+echo "Hello World";
The - at the start of aline indicates that that line has been removed, while the + indicates that that line has been added.
To apply a patch you use the patch command:
cd old/; patch -p1 < ../foo.patch
Now, if you look at old/foo.php
<?php
echo "Hello World";
Patching can be even easier these days of your project uses Git for version control. Git has it's own mechanism for creating and applying patches.