  Galaxies can be classified in two broad sequences which are likely to reflect
their formation mechanism. The `main sequence', consisting of spirals,
irregulars and all dwarf galaxies, is probably produced by gas settling within
dark matter haloes. We show that the sizes and surface densities along this
sequence are primarily determined by the distributions of the angular momentum
and formation time of dark haloes. They are well reproduced by current
cosmogonies provided that galaxies form late, at $z \la 2$. In this scenario,
dwarf ellipticals were small `disks' at $z\sim 1$ and become `ellipticals'
after they fall into cluster environments. The strong clustering of dwarf
ellipticals is then a natural by-product of the merging and transformation
process. The number of dwarf galaxies predicted in a cluster such as Virgo is
in good agreement with the observed number. On the other hand, the `giant
branch', consisting of giant ellipticals and bulges, is probably produced by
the merging of disk galaxies. Based on the observed phase-space densities of
galaxies, we show that the main bodies of all giant ellipticals can be produced
by dissipationless mergers of high-redshift disks. However, high-redshift
disks, although denser than present-day ones, are still not compact enough to
produce the high central phase space density of some low-luminosity
ellipticals. Dissipation must have occurred in the central parts of these
galaxies during the merger which formed them.
