Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to patch with a .diff file?

Tags:

diff

patch

I found this patch on source forge (cocoa.diff), and it implies that I can patch using the cocoa.diff file. However, I can't seem to figure out how to use the .diff file.

Thanks for any help!

EDIT: I tried "patch p1 < cocoa.diff" and the output was "patch: ** Only garbage was found in the patch input." Does this mean that the .diff file is corrupt or incorrect? Also, I'm using Mac OSX 10.6.

like image 523
hassaanm Avatar asked Jan 21 '12 02:01

hassaanm


People also ask

How do I apply a .diff patch?

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 Overwrite the original file with changes. In the example above, the diff output will be saved into a file named patchfile. patch.

How do I use a .diff file?

Applying a DIFF File in the Command LineCopy the DIFF files to the root directory of your store. Open the terminal on the server or access the server remotely via SSH. Replace /path/to/cscart/root/directory with the actual path to the root directory of your store. Replace example.

How do I patch a source code?

A patch is created by using the diff command to compare two directories: one directory contains the original version of the source code, and the other directory contains the new version of the source code. The output of the diff command is captured in a text file, which is the “patch”.


1 Answers

the file cocoa.diff seems OK, however the link failed the first time I tried and returned some error HTML which indeed looks like garbage to patch. Your command seems nearly OK (lacks a dash: patch -p1 < cocoa.diff seems better).

like image 91
armel Avatar answered Oct 16 '22 18:10

armel