Open Source Comes to Campus/Resources: Difference between revisions
Content added Content deleted
imported>Shauna |
imported>Shauna |
||
Line 33:
I have [a To Do List]! But maybe it needs editing. First, I'll make a copy to edit:
<pre>cp ToDoList new_ToDoList</pre>
Line 41 ⟶ 42:
<pre>diff -u ToDoList new_ToDoList</pre>
<pre>diff -u ToDoList new_ToDoList > changes.diff</pre>
I open up the file and see it contains the same stuff as was printed out before. Okay, now how do I apply these changes to the original list?
<pre>patch -p0 ToDoList < changes.diff</pre>
Note that the argument given to the patch is the file I want to modify, not the file that already has the changes.
People often ask - what does the argument "-u" given to diff mean, or the argument -p0 given to "patch"?
Well, -u tells diff to output in unified diff format. Two other formats are [http://en.wikipedia.org/wiki/Diff#Edit_script Edit script] (specified with -e) and [http://en.wikipedia.org/wiki/Diff#Context_format Context format] (specified with -c).
-p[x] is an argument which allows the user to specify how much of the given file's path needs to be matched. -p0 gives the entire file name unmodified. [http://www.gnu.org/software/diffutils/manual/html_node/patch-Directories.html#patch-Directories The documentation] has a bit more info.
=== Issue Tracker Demo ===
|