{"id":192,"date":"2016-01-12T15:34:42","date_gmt":"2016-01-12T15:34:42","guid":{"rendered":"http:\/\/wp-p3d2tsa2xh.pairsite.com\/?p=192"},"modified":"2025-05-21T14:12:55","modified_gmt":"2025-05-21T18:12:55","slug":"paircloud-diff-and-patch","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/","title":{"rendered":"How to use diff and patch"},"content":{"rendered":"<p class=\"p1\"><span class=\"s1\"><a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/shared-hosting\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">Shared<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/vps\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">VPS<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/qs-dedicated\/\"><p style=\"background-color:#1a3d6e !important;color:#fff;padding:6px; display:inline-block!important;font-size:12px; font-weight:bold; border-radius:3px;\">Dedicated<\/p><\/a>&nbsp;<a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional<\/p><\/a> <a style=\"color:#fff; text-decoration:none!important;\" href=\"https:\/\/www.pair.com\/support\/kb\/tags\/wp-professional-plus\/\"><p style=\"background-color:#1a3d6e !important;color:#fff !important;padding:6px; display:inline-block!important;font-size:12px;font-weight:bold; border-radius:3px;\">WP Professional Plus<\/p><\/a><\/span><\/p>\n<p><span style=\"font-weight: 400;\">The \"diff\" tool calculates the differences between two text files. That difference is called a patch. &nbsp;You can apply a patch to another file using the \"patch\" tool.<\/span><\/p>\n    \t\t<div class=\"hts-messages hts-messages--alert   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tdiff and patch are intended to be used on text files. Files that are binary or manipulated by purpose-built applications, like .doc, .pdf, .xlsx, or .wav files, don\u2019t work well with diff and patch.    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<h3>Why use diff and patch?<\/h3>\n<p><b>Reason 1<\/b><span style=\"font-weight: 400;\">: diff can be useful by itself to see what has changed between files, even if you never use patch. <\/span><\/p>\n<p><b>Reason 2<\/b><span style=\"font-weight: 400;\">: Sometimes you can get patches from third parties and apply them to your files. This can be beneficial in cases when the files being patched are large, but the number of changes is relatively small: transferring a patch file is more efficient than transferring the entire file.<\/span><\/p>\n<p><b>Reason 3: <\/b><span style=\"font-weight: 400;\">You can apply patches to files that don't perfectly match the original file used in diff. <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">For example, if you use a CMS with a configuration file, and make local modifications to that configuration file, you want to preserve those local changes when you upgrade your CMS. Copying the vendor's new configuration over your version will lose your changes. However, in many cases, you can still safely use patch to apply the vendor's changes from the most recent version without losing your own changes.<\/span><\/p>\n<h3>What is diff?<\/h3>\n<p><span style=\"font-weight: 400;\">diff is a way to compare files for differences (hence the name \"diff\") from the command line. For example, if you have an original file, then make some changes and save it under another name, you could compare the two using diff. <\/span><\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-5321\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff.png\" alt=\"using diff image\" width=\"560\" height=\"315\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff.png 560w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff-300x169.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff-50x28.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff-60x34.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff-100x56.png 100w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/a><\/p>\n<h4>diff Syntax<\/h4>\n<p><span style=\"font-weight: 400;\">diff is used in the command line. The basic diff syntax looks like this: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff [options] [original filename] [changed filename]<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">This command sets up the basic structure for comparing one file to another. There are also <\/span><a href=\"#options\"><span style=\"font-weight: 400;\">options <\/span><\/a><span style=\"font-weight: 400;\">to add more functionality to a command.<\/span><\/p>\n<h5>Basic Syntax (without Options)<\/h5>\n<p><span style=\"font-weight: 400;\">Replace <\/span><span style=\"font-weight: 400; font-family: monospace;\">[original filename]<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400; font-family: monospace;\">[changed filename]<\/span><span style=\"font-weight: 400;\"> with the actual names of the files. Be sure to include the file extensions with the file names. A basic diff command without options may look something like this: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff file1.html file2.html<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">In this example, the command would compare <\/span><span style=\"font-family: monospace;\">file1.html <\/span><span style=\"font-weight: 400;\">and<\/span><span style=\"font-family: monospace;\"> file2.html <\/span><span style=\"font-weight: 400;\">and output the differences into the command line.<\/span><\/p>\n<h5>diff Syntax (with Options)<\/h5>\n<p><span style=\"font-weight: 400;\">diff options add more functionality to commands. However, options will change the command syntax a little. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">diff options go between <\/span><span style=\"font-weight: 400;\">diff <\/span><span style=\"font-weight: 400;\">and the first filename:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff <span style=\"color: #ff0000;\">-y<\/span> file1.html file2.html<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">You can also combine multiple options in one command. Do this by adding all the pertinent options\u2019 letters after the dash (-). It will end up looking something like this:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff -uy file1.html file2.html<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">You may also see a variation that gives each option its own dash (-). Both methods of adding multiple options are valid<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff -u -y file1.html file2.html<\/span><\/pre>\n<p><span style=\"font-weight: 400;\"><a name=\"options\"><\/a>See below for a list of commonly used options:<br \/>\n<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Option<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-N<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Ignores absent files<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-r<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Recursively executes diff through a directory. Used to compare multiple files at once. <\/span><i><span style=\"font-weight: 400;\">Note: this is not the same as <\/span><\/i><a href=\"#R\"><i><span style=\"font-weight: 400;\">-R<\/span><\/i><\/a><i><span style=\"font-weight: 400;\">, which is a patch option<\/span><\/i><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-u<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Displays output in an easier to read format. This may remove some information, such as context lines. <\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-y<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Forces output to display differences side by side. <\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">For more options, see <\/span><a href=\"http:\/\/www.gnu.org\/software\/diffutils\/manual\/html_node\/diff-Options.html\"><span style=\"font-weight: 400;\">this list of diff options by GNU. <\/span><\/a><\/p>\n<h4>diff Output<\/h4>\n<p><span style=\"font-weight: 400;\">When a diff command is run, the basic output will look similar to this: <\/span><\/p>\n    \t\t<div class=\"hts-messages hts-messages--alert   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\t<i><span style=\"font-weight: 400;\">Using the <\/span><\/i><i><span style=\"font-weight: 400;\">-y<\/span><\/i><i><span style=\"font-weight: 400;\"> option will change how the output is displayed<\/span><\/i>    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<pre><span style=\"font-weight: 400;\">11c11<\/span>\n<span style=\"font-weight: 400;\">&lt; this is text from the original file<\/span>\n<span style=\"font-weight: 400;\">---<\/span>\n<span style=\"font-weight: 400;\">&gt; this is the same line from the second, changed file<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Only changes will be displayed in the output, so you don\u2019t have to weed through the two files. Instead, diff compares and pulls the changes out for you to view. &nbsp;<\/span><\/p>\n    \t\t<div class=\"hts-messages hts-messages--success  hts-messages--withtitle hts-messages--withicon \"   >\r\n    \t\t\t<span class=\"hts-messages__title\">Tip<\/span>    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tThe \u201c&gt;\u201d and \u201c&lt;\u201d characters in diff output point in the direction of the file in which the content is found. So, for the command \u201c<span style=\"font-family: monospace;\">diff file1 file2\u201d<\/span>, a \u201c&lt;\u201d refers to lines from file1 and \u201c&gt;\u201d refers to lines from file2.    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-5322\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip.png\" alt=\"content tip image\" width=\"595\" height=\"105\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip.png 595w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip-300x53.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip-50x9.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip-60x11.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/content-tip-100x18.png 100w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<h5>How to Read diff Output<\/h5>\n<p><span style=\"font-weight: 400;\">Here\u2019s a brief guide about reading diff\u2019s output. <\/span><\/p>\n<h6>The First Line of Output<\/h6>\n<p><span style=\"font-weight: 400;\">The first line in the output indicates the line numbers that contain differences and the type of changes that have been made. <\/span><\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-5323\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff.png\" alt=\"diff output image\" width=\"439\" height=\"98\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff.png 439w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff-300x67.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff-50x11.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff-60x13.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/output-diff-100x22.png 100w\" sizes=\"(max-width: 439px) 100vw, 439px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">If two numbers are separated by a comma, this means that there are changes from the first line number through to the second. In the example image above, 11,12 would indicate that there are changes on lines 11 - 12. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The \u201cc\u201d that separates the line numbers in the example above indicates the type of change that occurred. There are different letters that indicate different types of changes:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Letter<\/b><\/td>\n<td><b>Meaning<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">c<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Content was replaced<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">a<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Content was added or appended<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">d<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Content was deleted <\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">When using patch, which will be explained in the <\/span><a href=\"#patch\"><span style=\"font-weight: 400;\">What is patch? <\/span><\/a><span style=\"font-weight: 400;\">section, these letters will be important.<\/span><\/p>\n<h6>The Rest of Output<\/h6>\n<p><span style=\"font-weight: 400;\">The rest of the output concerns the actual differences between files. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The changed lines will be listed next to &lt; or &gt; angle brackets. Three dashes (---) indicate that the end of the first file\u2019s line changes and the beginning of the next file\u2019s. It will look like this: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt; text from file one<\/span>\n<span style=\"font-weight: 400;\">---<\/span>\n<span style=\"font-weight: 400;\">&gt; text from file two<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Now that you have a basic understanding of diff, it\u2019s time to move on to patch.<\/span><br \/>\n<a name=\"patch\"><\/a><\/p>\n<h3>What is patch?<\/h3>\n<p><span style=\"font-weight: 400;\">patch is a command that takes the output from the diff and puts it into a file. Then, it can take the filed output and overwrite another file with with the changes. For example, a common use is to use the patch to transfer changes from the changed file to the original file, thus making them identical. While this can also be accomplished by copy\/pasting the updated file into the original file, patch is much faster and efficient. <\/span><\/p>\n<h3>How to use diff and patch Together<\/h3>\n<p><span style=\"font-weight: 400;\">diff works by cataloging the changes between the two files or folders. Patch can take those changes, put them in a file, and update older versions with it. <\/span><\/p>\n<h4>patch Options<\/h4>\n<p><span style=\"font-weight: 400;\">The patch command also has its own set of options to add functionality. Find a list of commonly used options below: <\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400;\">-b<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Creates a backup of the original file<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-i<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Forces the command to read the patch from the .patch file instead of from standard input<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-p[#]<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Instructs the command to strip # number of slashes from the filepath to the filename. You\u2019ll see in most of our examples, we use <\/span><span style=\"font-weight: 400;\">-p0<\/span><span style=\"font-weight: 400;\"> so that no slashes are stripped away<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\"><a name=\"R\"><\/a>-R<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Reverses the previous patch<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">-s<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Runs the command silently. It will only show process if there are errors<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"font-weight: 400;\">For more options, see <\/span><a href=\"http:\/\/www.gnu.org\/software\/diffutils\/manual\/html_node\/patch-Options.html\"><span style=\"font-weight: 400;\">this list of patch options by GNU<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><br \/>\n<a name=\"create\"><\/a><\/p>\n<h4>Creating a patch<\/h4>\n<p><span style=\"font-weight: 400;\">Creating a patch file is the first step for using patch and diff together. The patch file can be used to add changes to other files, and so it is necessary for commands like <\/span><a href=\"#overwrite\">Overwrite the original file with changes<\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To create a patch file, enter the command below into the command line:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff -u file1.html file2.html &gt; patchfile.patch<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">In the example above, the diff output will be saved into a file named <\/span><span style=\"font-weight: 400;\">patchfile.patch<\/span><span style=\"font-weight: 400;\">. When executing the command, be sure to change <\/span><span style=\"font-weight: 400;\">file1.html <\/span><span style=\"font-weight: 400;\">and <\/span><span style=\"font-weight: 400;\">file2.html<\/span><span style=\"font-weight: 400;\"> to actual file names.<\/span><br \/>\n<a name=\"overwrite\"><\/a><\/p>\n<h4>Overwrite files with changes<\/h4>\n<p><span style=\"font-weight: 400;\">Once the <\/span><a href=\"#create\"><span style=\"font-weight: 400;\">patch file is created<\/span><\/a><span style=\"font-weight: 400;\">, you can use it to copy the changes to another file. For example, you may want to overwrite file1 with the changes from the updated file2. To do this, you could use syntax like this:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">patch file1.html patchfile.patch<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Replace <\/span><span style=\"font-weight: 400; font-family: monospace;\">file1.html <\/span><span style=\"font-weight: 400;\">with your original file. This would overwrite the old contents of <\/span><span style=\"font-weight: 400; font-family: monospace;\">file1.html<\/span><span style=\"font-weight: 400;\"> with the changed contents of <\/span><span style=\"font-weight: 400; font-family: monospace;\">file2.html<\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4>How to Reverse a patch<\/h4>\n<p><span style=\"font-weight: 400;\">If you want to revert the file to its previous version before patching, you can do so by running this command: <\/span><\/p>\n<pre><span style=\"font-weight: 400;\">patch -p0 -R -i patchfile.patch<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">The command line will then prompt you to input the name of the file you want to revert. Once the filename has been entered, the reversing process will begin. If successful, the file will be reverted to its previous state.<\/span><\/p>\n<h4>patch Directories<\/h4>\n<p><span style=\"font-weight: 400;\">Using diff and patch on whole directories is a similar process to using it on single files. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">The first step is to create a patch file by using the command:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">diff -ruN folder1\/ folder2\/ &gt; patchfile.patch<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Then, you would issue the command to patch the original folder, which in this case is <\/span><span style=\"font-weight: 400; font-family: monospace;\">folder1<\/span><span style=\"font-weight: 400;\">:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">patch -s -p0 &lt; patchfile.patch<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">If successful, your original directory should now be updated to match the second, updated folder.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; The &#8220;diff&#8221; tool calculates the differences between two text files. That difference is called a patch. &nbsp;You can apply a patch to another file using the &#8220;patch&#8221; tool. Why use diff and patch? Reason 1: diff can be useful by itself to see what has changed between files, even&#8230;<\/p>\n","protected":false},"author":12,"comment_status":"closed","ping_status":"open","template":"","format":"standard","meta":[],"ht-kb-category":[13],"ht-kb-tag":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Use diff and patch | Apply diff patch | diff patch Example<\/title>\n<meta name=\"description\" content=\"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use diff and patch | Apply diff patch | diff patch Example\" \/>\n<meta property=\"og:description\" content=\"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-21T18:12:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/\",\"name\":\"How to Use diff and patch | Apply diff patch | diff patch Example\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2016-01-12T15:34:42+00:00\",\"dateModified\":\"2025-05-21T18:12:55+00:00\",\"description\":\"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use diff and patch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use diff and patch | Apply diff patch | diff patch Example","description":"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/","og_locale":"en_US","og_type":"article","og_title":"How to Use diff and patch | Apply diff patch | diff patch Example","og_description":"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.","og_url":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2025-05-21T18:12:55+00:00","og_image":[{"url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2016\/01\/Using-diff.png"}],"twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/","url":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/","name":"How to Use diff and patch | Apply diff patch | diff patch Example","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2016-01-12T15:34:42+00:00","dateModified":"2025-05-21T18:12:55+00:00","description":"Use diff and patch tools to compare and change files. diff compares the files and patch applies the output to other files. Learn how to apply diff patch.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/paircloud-diff-and-patch\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"How to use diff and patch"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/192"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=192"}],"version-history":[{"count":6,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/192\/revisions"}],"predecessor-version":[{"id":9796,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/192\/revisions\/9796"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=192"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=192"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}