New version of the merging script, now exiting if there's nothing to merge.