When a file changes on disk while you're editing in Emacs, how to merge both sets of changes into the file?
2 Answers
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.
Currently I manually resolve the conflict as follows:
write-file
the buffer visiting the original file to a temporary fileediff-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