Check the target branch when pulling upstream projects - 15.7
Cherry pick !3433 (merged) into 15.7.
We might not need this in the end, but let's pick this into 15.7 proactively, since 15.7 is gonna be in the online versions for two more milestones.