  The link between massive red galaxies in the local Universe and star-forming
galaxies at high redshift is investigated with a semi-analytic model that has
proven successful in many ways, e.g. explaining the galaxy colour-magnitude
bimodality and the stellar mass-age relation for red-sequence galaxies. The
model is used to explore the processes that drive star formation in different
types of galaxies as a function of stellar mass and redshift. We find that most
z=2-4 star-forming galaxies with M_*>10^10 M_Sun evolve into red-sequence
galaxies. Also, most of the massive galaxies on the red-sequence today have
passed through a phase of intense star formation at z>2. Specifically, ~ 90% of
today's red galaxies with M_*>10^11 M_Sun were fed during this phase by cold
streams including minor mergers. Gas-rich major mergers are rare and the
effects of merger-driven starbursts are ephemeral. On the other hand, major
mergers are important in powering the most extreme starbursts. Gas-rich mergers
also explain the tail of intermediate-mass red galaxies that form relatively
late, after the epoch of peak star formation. In two thirds of the currently
red galaxies that had an intense star formation event at $z<1$, this event was
triggered by a merger.
