Galactic star formation and accretion histories from matching galaxies to dark matter haloes | Synapse