switch branch only if required
update the local branches if needed