  We present a detailed prescription for how galaxy formation can be modelled
in hierarchical theories of structure formation. Our model incorporates the
formation and merging of dark matter halos, the shock heating and radiative
cooling of baryonic gas gravitationally confined in these halos, the formation
of stars regulated by the energy released by evolving stars and supernovae, the
merging of galaxies within dark matter halos, and the spectral evolution of the
stellar populations that are formed. The procedure that we describe is very
flexible and can be applied to any hierarchical clustering theory. We explore
the effects of varying the stellar initial mass function, star formation rates
and galaxy merging. The results we compare with an extensive range of
observational data, including the B and K galaxy luminosity functions, galaxy
colours, the Tully-Fisher relation and galaxy number counts.These data strongly
constrain the models and enable the relative importance of each of the physical
process to be assessed. We present a broadly successful model defined by a
plausible choice of parameters. This fiducial model produces a much more
acceptable luminosity function than most previous studies. This is achieved
through a modest rate of galaxy mergers and strong suppression of star
formation in halos of low circular velocity. However, it fails to produce
galaxies as red as many observed ellipticals and, compared with the observed
Tully-Fisher relation, the model galaxies have circular velocities which are
too large. ** uuencoded compressed postscript file containing all text and
figures.**
