How to create a patch, how to apply it?


After having proposed a modification to on the lib in order to manage correctly, I have been asked for sending the associated patch… Of course, I will!.. But before, I need to learn how to make a patch. Here is the way to do it:

Let’s imagine I have my file that has a bug, and the that is the with the bug correction. to generate the patch, do:

diff -ruN >mypatch

-r is to do it recursively. In how case, not really useful, but you can create patch on directories.

-u will output 3 lines of unified context. Default is 3. -U4 will put 4 lines...

-N will be used to treat absent files as empty files. Same, in our case not useful, but usefull for patches on directories.

Now, how to apply a patch:

patch < mypatch for a file.
patch -pNUM < mypatch #where NUM is the recursive depth for directories

Here it is…

Let me know, if this helped!

That’s it, you have made a patch.

How to use it

Pas d'articles similaires.

Posted in python. Bookmark the permalink. RSS feed for this post. Leave a trackback.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Protected by WP Anti Spam

Swedish Greys - a WordPress theme from Nordic Themepark.