Using ediff under Emacs.
Monday, 9. June 2008, 05:24:42
Many people don't know how to merge source code under GNU/Linux, and many people are discussing which tool is better under GNU/Linux. Obviously you will have many choices, even more than under Windows.
1, sdiff
2, vimdiff
3, Emacs/Ediff
4, meld
5, kdiff
etc...
And here I'm introducing the very powerful and clear 'Emacs/Ediff' solution. The advantages of using ediff include that can work smoothly both under X and console, integrated with Emacs which you can get benefit from PCL-CVS and give you the ability to merge between 3 files.
Ediff is a buffer type of emacs, to launch ediff you can easily use,
1, M-x ediff-files / M-x ediff-buffers
2, M-x ediff-directories
3, M-x ediff-files3 ...
Select the A target and B target, then you will get the result in two splitted windows.
1, press '|' to change from vertical window layout to horizontal window layout.
2, ediff floating window should be shown and all operation key sequence should go through that window.
3, ? to get help. And I think that help is enough, you don't have to refer to any other docs.
a/b key can easily merge the code from A to B or B to A. Remember to use 'ra' or 'rb' to revert your change, and 'wa' or 'wb' to save corresponding buffer.
In case of comparing directories, your files are treated as sessions. So that you will have a session list buffer and allow you to dispose files one by one.
You may also want to add '-b' option to your diff program when you are working on C/C++ sources. That will igore lines contains only blank difference, space or tabs.
1, sdiff
2, vimdiff
3, Emacs/Ediff
4, meld
5, kdiff
etc...
And here I'm introducing the very powerful and clear 'Emacs/Ediff' solution. The advantages of using ediff include that can work smoothly both under X and console, integrated with Emacs which you can get benefit from PCL-CVS and give you the ability to merge between 3 files.
Ediff is a buffer type of emacs, to launch ediff you can easily use,
1, M-x ediff-files / M-x ediff-buffers
2, M-x ediff-directories
3, M-x ediff-files3 ...
Select the A target and B target, then you will get the result in two splitted windows.
1, press '|' to change from vertical window layout to horizontal window layout.
2, ediff floating window should be shown and all operation key sequence should go through that window.
3, ? to get help. And I think that help is enough, you don't have to refer to any other docs.
a/b key can easily merge the code from A to B or B to A. Remember to use 'ra' or 'rb' to revert your change, and 'wa' or 'wb' to save corresponding buffer.
In case of comparing directories, your files are treated as sessions. So that you will have a session list buffer and allow you to dispose files one by one.
You may also want to add '-b' option to your diff program when you are working on C/C++ sources. That will igore lines contains only blank difference, space or tabs.













