Galaxies grow through gas accretion of diffuse and filamentary gas and through mergers with various mass ratios. This growth is regulated by feedback from massive stars and black holes. I will discuss the gas accretion rate onto haloes and their central galaxies computed in cosmological, hydrodynamical simulations. Accretion rates onto galaxies are determined by radiative cooling and by outflows as well as by their halo mass. In massive galaxies, AGN feedback lowers the galaxy's gas accretion rate, which reduces the star formation rate. This results in quenched galaxies that acquire most of their stellar mass through mergers rather than through in situ star formation below z=1, consistent with the inside-out growth found by observations. Galactic winds are necessary to reduce the star formation rate in Milky Way-like galaxies. However, these can be so violent that it becomes hard to maintain a gas disc, from which to form a stellar disc, for a sufficiently long time. I will show preliminary results from a zoom-in simulation of a Milky-Way mass galaxy with efficient feedback, which does form a stellar disc at low redshift. Additionally, I will show results for the metal enrichment of this galaxy. Specifically, the gas is enriched with iron by supernovae and with rapid neutron capture (r-process) elements by binary neutron star (NS) mergers. Simple calculations without structure formation and galactic winds 'proved' that NS mergers could not be the source of r-process elements. However, we predict there is a wide range of stellar r-process abundance ratios, with both supersolar and subsolar abundances. I will show that the abundances are reasonably consistent with observations and show that NS mergers could be the source of most of the r-process nuclei in the Universe.