(macros)
Tools

Ediff

Compare files and merge changes between them, built on the editor's diff primitive (Emacs ediff). A diff opens as a read-only, color-coded view; the interactive merge tool lets you copy hunks back and forth between two open buffers.

Diffing files

Command Action
ediff Prompt for two files and show their diff
ediff-current-with Diff the current file against another file you pick

The diff opens in a read-only diff-mode buffer with added and removed lines colored. Press q to close it.

Merging between buffers

ediff-buffers picks two open buffers and lists their differing hunks in an interactive ediff-mode buffer, where you can copy a hunk from one side into the other.

Key Command Action
n ediff-next-hunk Move to the next hunk
p ediff-prev-hunk Move to the previous hunk
a ediff-copy-a->b Copy the hunk at point from buffer A into B
b ediff-copy-b->a Copy the hunk at point from buffer B into A
g Refresh the diff
q kill-buffer Close

The entry commands (ediff, ediff-current-with, ediff-buffers) have no default key — run them by name with M-x, or bind them in your init.scm. For a Git-focused diff of staged/unstaged changes, see Git (Magit).