tweaked publish_branch util