Today’s development discussion was interesting. We had several difficulties actually demoing some of the tools, largely because complicated merge conflicts don’t happen enough for anyone to be practiced enough with them to fully understand their chosen tools.
Just about everyone in the room said they manually resolve conflicts by editing the file directly as desired. It was pointed out that this can be exceedingly difficult when, for instance, the conflicting change included re-indentation (say, a wrapping module was added to the file). It can be very difficult to see the actual changes and tools can be really helpful in those cases.
@jferris demoed the setup he’s been using which was the only of the three attempts at demoing vimdiff that actually worked correctly. It was also very handy to have three different tabs available with the different views of the conflict (two pane, three pane, conflicted file).
@gfontenot had some praise for kaleidoscope. While it does not (yet) support syntax highlighting, it does offer block, fluid, and unified layouts in both two pane and three-pane setups. While it previously only supported diffing, it has recently added support for merging. When merging it’s possible to directly modify the working copy, which isn’t the case with opendiff (the default git mergetool on OS X, at least). It also supports switching between several conflicted files easily, which is not the case with vimdiff in general.
We spent some time discussing some git configuration options that effect merging and diffing. It sounded like these were helpful options that it may be worth discussing/adding to dotfiles:
[mergetool]
trustExitCode = true
keepBackup = false
trustExitCode
tells git that if the mergetool exits cleanly it should assume the conflict has been successfully resolved. By default, using git mergetool will save a backup file with the .orig
extension. The keepBackup
setting disables this.
If you find yourself in a situation where you need to have a long-running branch, you should rebase often in order to avoid merge conflicts. You’re still likely to get them, though. You may even get the same conflict several times. git rerere
may be able to help with this by remembering how you resolved the previous versions of the same conflict and applying that in the future (reuse recoreded resolution). This might be worth enabling temporarily while working in this situation.