Extract merging code out of git-pr script. Getting ready for difftool.