2

When a file changes on disk while you're editing in Emacs, how to merge both sets of changes into the file?

Nova
  • 1,059
  • 9
  • 21

2 Answers2

3

As you're familiar with ediff you can also:

M-x ediff-current-file

Start ediff between current buffer and its file on disk. This command can be used instead of `revert-buffer'. If there is nothing to revert then this command fails.

I have both this and a custom diff-buffer-with-file variant bound to keys, as I use them quite frequently.

phils
  • 48,657
  • 3
  • 76
  • 115
0

Currently I manually resolve the conflict as follows:

  • write-file the buffer visiting the original file to a temporary file
  • ediff-merge-files the original file and the temporary file
  • When finished, quit Ediff and confirm when it asks whether to kill buffer A and B.
  • write-file buffer B (*ediff-merge*) to the original file
Nova
  • 1,059
  • 9
  • 21