Basically a reland of ec9d80ec but now with fetching of main before that to get a correct merge base.