Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 14: Finding Differences Between Files

Previous HourNext Hour

Sections in this Hour:

 

Diffing Two Files with a Common Ancestor

When diffing two files that are the same file edited in two different places (for example, by two different persons working on the same project) you can get into a situation where file A contains text that isn't in file B. In these situations, there are two possibilities:

To find which of the two possibilities is the correct one, you need to look in the original file. If the text is in the original, it must have been deleted from file B; otherwise it must have been added to file A.

To ease the work in situations such as this, Emacs has two functions called ediff-buffers3 and ediff-files3. These functions take three files and shows their differences. The order of the files doesn't matter, as long as the files include the original file and its two variants. Figure 14.3 shows the Emacs window when ediff-buffer3 is used.

All the commands for moving around and copying between buffers that were described in the previous section still apply, with the exception that instead of typing a for copying text from buffer A to buffer B, you must now type ab to copy text from buffer A to buffer B. Likewise there are commands to copy text in other directions, for example, cb to copy text from buffer C to buffer B.

Figure 14.3
The Emacs interface to diff-buffers3.

Sams Teach Yourself Emacs in 24 Hours

ContentsIndex

Hour 14: Finding Differences Between Files

Previous HourNext Hour

Sections in this Hour: