A patch is piece of code used to adding new features, or fixing bugs, or adding documentation to the project. Patch is simple text file contains difference between two version of the same file. Before applying patch to your project always take a backup.Patch is generally for open source contribution.
Steps to create and apply patch for single file:
Now, copy the add.c to add_new.c
Edit the add_new.c as below:
create the patch file using diff command:
Patch file: add.patch
- in the code means this line is removed. + in the code means this line is added.
Now apply patch to original source code: add.c
In next post we will learn how to apply patch to source code tree.