fwiw sometimes the branches get force pushed around, so a more robust solution is probably to do what update.sh is doing:

git fetch
git reset --hard origin/$branch