Language Selection

English French German Italian Portuguese Spanish

How to Create Patch Files Using Patch & Diff

Filed under
HowTos

Patch file is a readable file that created by diff with -c (context output format). It doesn’t matter and if you wanna know more, man diff. To patch the entire folder of source codes (as usually people do) I do as below:

Assume Original source code at folder Tb01, and latest source code at folder Tb02. And there have multiple sub directories at Tb01 and Tb02 too.

diff -crB Tb01 Tb02 > Tb02.patch

-c context, -r recursive (multiple levels dir), -B is to ignore Blank Lines.
I put -B because blank lines is really useless for patching, sometimes I need to manually read the patch file to track the changes, without -B is really headache.

Full Story.

compare files and edit simultaneously with vimdiff

Refers to How to create patch file using patch and diff, you can actually read the diff file to compare the difference between the files. But what if you wanna compare and edit simultaneously?

Given 2 different files at your hand, you can do that with vimdiff. Let say I wanna compare this two files Tb01/TbApi.cpp and Tb02/TbApi.cpp, I can do this

vimdiff Tb01/TbApi.cpp Tb02/TbApi.cpp

More Here.

----
You talk the talk, but do you waddle the waddle?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

More in Tux Machines

Knoppix Topics: An interview with Linux pioneer Klaus Knopper

At this year’s CeBIT trade show in Hanover, Germany, Christopher von Eitzen sat down with Linux legend Klaus Knopper to discuss his popular Knoppix Linux distribution as well as Linux and accessibility in open source software. Designed to boot and run directly from a CD, DVD or USB flash drive without needing to be installed on a computer’s hard drive, Knoppix incorporates automatic hardware detection with support for a wide range of video and sound cards, USB devices and other peripherals and uses and on-the-fly decompression to run entirely in a computer’s memory. The CD version carries up to 2GB of executable software, while the single-layer DVD edition stores up to 10GB of data. The operating system can be used, for example, as a rescue system, to demonstrate Linux, as an educational CD, or installed directly to a system. Read more

LibreOffice 4.4.3 RC2 Is Out, Stable Version Should Arrive Very Soon

The Document Foundation has just announced that the second RC (Release Candidate) for the LibreOffice 4.4.3 branch has been released and is now available for download and testing. Read more

New Ubuntu Touch OTA Update Planned for This Week

Ubuntu Touch is working great on the Bq Aquaris and Nexus 4 devices, especially after the previous update, and now the developers are focusing on a new OTA upgrade that should also bring some interesting fixes. Read more