Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

recursive diff to create a patch and apply patch recursively

Tags:

diff

patch

I'm running into trouble using patch. I have 2 folders with many subfolders and files.

diff -ur backup/www/ www/ > sync.patch

Next, I'm trying to apply the patch.

patch < sync.patch

It asks me File to patch: as you can see.

|diff -ur ./backup/www/members/categorize.php ./www/members/categorize.php
|--- ./backup/www/members/categorize.php   2012-12-13 15:19:41.000000000 -0500
|+++ ./www/members/categorize.php   2012-10-15 23:32:12.000000000 -0400
--------------------------
File to patch:

The file ./www/members/categorize.php exists.

like image 457
Poe Avatar asked Jan 12 '13 18:01

Poe


People also ask

How do I apply a diff patch in Windows?

Highlight your project to select it. From the main menu, select menu Tools -> Apply Diff Patch. In the resulting dialog, browse to your patch file, select it, and press the Patch button.

What does the patch command do?

The patch command reads a source file's instructions on how to change a file, then applies the changes. The source file contains difference listings (or diff listings) produced by the diff -c or -u command, and one or more sets of diff command output, customarily called hunks.


1 Answers

You probably need to investigate the -p flag for patch, which controls the way that directory prefixes are treated. See the man page.

like image 77
Oliver Charlesworth Avatar answered Apr 28 '23 13:04

Oliver Charlesworth