30sec on diff & patch

2 views
Skip to first unread message

hq4...@gmail.com

unread,
Mar 31, 2005, 7:23:05 AM3/31/05
to bash...@googlegroups.com
========================
Creating a Patch File:
========================

diff -Naur olddir newdir > new-patch
- or -
diff -Naur oldfile newfile >new-patch

========================
Using the Patch Command:
========================

patch -p0 <new-patch
patch -p1 <new-patch

cat new-patch | patch -p0

========================
Levels in the Patch Command (-p0 or -p1?):
========================

The -p option will optionally strip off directory levels from the
patchfile. For Ex: if you have a patchfile with a header as such:

--- old/modules/pcitable Mon Sep 27 11:03:56 1999
+++ new/modules/pcitable Tue Dec 19 20:05:41 2000

Using a -p0 will expect, from your current working directory, to find a
subdirectory called "new", then "modules" below that, then the
"pcitable" file below that.

========================
An Example of one method to browse a patchfile:
========================

less /tmp/file-patch <ENTER>
/--- <ENTER>
n


====================================================================
http://www.cpqlinux.com/patch.html
====================================================================

Reply all
Reply to author
Forward
0 new messages