Preparing tree for merge