Clustering of galaxies in a hierarchical universe - II. Evolution to high redshift