Halo assembly bias is the secondary dependence of the clustering of dark-matter haloes on their assembly histories at fixed halo mass. This established dependence is expected to manifest itself on the clustering of the galaxy population, a potential effect commonly known as galaxy assembly bias. Using the IllustrisTNG300 magnetohydrodynamical simulation, we analyse the dependence of the properties and clustering of galaxies on the shape of the specific mass accretion history of their hosting haloes (sMAH). We first show that several halo and galaxy properties strongly correlate with the slope of the sMAH ($beta$) at fixed halo mass. Namely, haloes with increasingly steeper $beta$ increment their halo masses faster at early times, and their hosted galaxies present larger stellar-to-halo mass ratios, lose their gas faster, reach the peak of their star formation histories at higher redshift, and become quenched earlier. We also demonstrate that $beta$ is more directly connected to these key galaxy formation properties than other broadly employed halo proxies, such as formation time. Finally, we measure the secondary dependence of galaxy clustering on $beta$ at fixed halo mass as a function of redshift. By tracing back the evolution of individual haloes, we show that the amplitude of the galaxy assembly bias signal for the progenitors of $z=0$ galaxies increases with redshift, reaching a factor of 2 at $z = 1$ for haloes of $M_mathrm{halo}=10^{11.5}-10^{12}$ $h^{-1}mathrm{M}_odot$. The measurement of the evolution of assembly bias along the merger tree provides a new theoretical perspective to the study of secondary bias. Our findings, which show a tight relationship between halo accretion and both the clustering and the observational properties of the galaxy population, have also important implications for the generation of mock catalogues for upcoming cosmological surveys.