Patching individual files

Tutorial ButtonHaving trouble with the mission? Read how to get help.

Patching individual files

Patching individual files

Critics love your recipes:

The audacity of the author’s “oven pancake” is
exceeded only by its simplicity, which is further exceeded by its
tastiness.

— Pancake Digest Weekly

An enthusiastic fan noticed, however, that you forgot to add
the temperature for the oven! Luckily, she sent you a patch
with a fix.

Your task is to download a copy of your original recipe,
download the contributed patch file, and use the patch
command to combine the two.

Essential links:

If you need help with this step, try clicking through these hints.

The “low” hint level is perfect if you’re just confused as to what to do.

The “high” level is great if you are unfamiliar with the commands and tools you’d use.

Read the man page for patch online,

or, if you’re on Linux or Mac, use the terminal command:

man patch

One way to accomplish this is by running a command like

patch < patch_file

from the command-line, in the directory containing both patch_file and the original file (replace "patch_file" with the actual name of the file you downloaded).

This command says “use the patch program to apply the diff in patch_file to a file in the current directory”.

You can read more about the patch program in its man page or if you are on Mac or Linux, type:

man patch

at the command-line.

Open a command prompt, and type these commands in, one at a time. You need to copy them exactly. Make sure to press enter between each one.

First, create a directory you’ll work in and change into it.

	mkdir singlediffpatch
cd singlediffpatch

Then, download the original file and the modified file.

	curl -0 https://www.vedova.org/download/training/missions/diffpatch/patchsingle/oven-pancake.txt
curl -0 https://www.vedova.org/download/training/missions/diffpatch/patchsingle/add-oven-temp.patch

Then, use the patch command to apply the changes.

	patch < add-oven-temp.patch

At this point, oven-pancake.txt has been modified. You can
verify that by opening that file in your favorite text editor.

Submit the oven-pancake.txt file, and you should pass!