Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly does the word Patch mean when referring to 'submitting a patch'?

What exactly does the word patch mean when referring to 'submitting a patch'?

I've seen this used a lot, especially in the open source world. What what does it mean and what exactly is involved in submitting a patch?

like image 588
Gary Willoughby Avatar asked Oct 08 '08 18:10

Gary Willoughby


1 Answers

It's a file with a list of differences between the code files that have changed. It's usually in the format generated by doing a diff -u on the two files. Most version control systems allow the easy creation of patches but it's generally in that same format.

This allows the code change to be easily applied to someone else's copy of the source code using the patch command.

For example:

Let's say I have the following code:

<?php
  $foo = 0;
?>

and I change it to this:

<?php
  $bar = 0;
?>

The patch file might look like this:

Index: test.php
===================================================================
--- test.php    (revision 40)
+++ test.php    (working copy)
@@ -3,7 +3,7 @@
         <?php
-            $foo = 0;
+            $bar= 0;
         ?>
like image 178
Mark Biek Avatar answered Oct 11 '22 05:10

Mark Biek