When Git (or another VCS) attempts to apply a patch that doesn't apply cleanly, it will defer to you, the user, to figure out the right thing to do. Usually you get, dumped in your lap, a file that has all these funny conflict markers in it, showing alternative versions of the content:
<action name="Execute"><execute>google-chrome</execute></action> </keybind> <keybind key="W-s-b"> <<<<<<< HEAD <action name="Execute"><execute>firefox-3.6</execute></action> ======= <action name="Execute"><execute>firefox-3.7</execute></action> >>>>>>> f50523b... </keybind> <keybind key="W-a"> <action name="Execute"><execute>rhythmbox</execute></action>
You can edit that file by hand to get the state you want, but Emacs has a specialized mode for resolving conflicts. Type M‑x vc‑resolve‑conflicts and you get a three-paned frame like the following:
- Press n and p to move between diff hunks.
- For each hunk you can press a or b to transfer the version from the left or right side, respectively, to the output. You can leave the conflicted versions if there's something you really need to fix up by hand.
- Press q when you're done. Emacs returns you to your fixed-up file. Save it.
Being an Emacs user you might hate me for this and this question might be a bit silly :) but do you know if vi(m) has anything like this? I use vim diff with a very similar layout but it's a fairly manual process.
ReplyDelete@Adriano: I have no idea whether vim can be made to do something similar. Sorry.
ReplyDeleteVimdiff...
ReplyDeleteuse DiffMerge
ReplyDelete