To produce a patch from the command line in Linux, it is important to have both the original and modified folders setup at the same directory level. For example, two folders "/home/user/OriginalFolder" and "/home/user/ModifiedFolder". We will first change into the folder that contains the folders that we are patching, for our example this would be as follows:
Now to produce a patch named "MyPatch.patch" we would issue the following command:
The patch will now contain all of the difference information and act as an instruction on how to produce ModfiedFolder from the OriginalFolder. If we want to apply this patch (say for example to the "OriginalFolder", we would first need to change in to the path of the source that we are going to patch and apply the patch as follows:
If you now compare the "OriginalFolder" to the "ModifiedFolder" there should be no differences. Congratulations, you have just created and applied your first patch.
“Live as if you were to die tomorrow. Learn as if you were to live forever.”