Gravity currents of miscible fluids in porous media are important to understand because they occur in important engineering projects, such as enhanced oil recovery and geologic CO2 sequestration. These flows are often modelled based on two simplifying assumptions: vertical velocities are negligible compared with horizontal velocities, and diffusion is negligible compared with advection. In many cases, however, these assumptions limit the validity of the models to a finite, intermediate time interval during the flow, making prediction of the flow at early and late times difficult. Here, we consider the effects of vertical flow and diffusion to develop a set of models for the entire evolution of a miscible gravity current. To gain physical insight, we study a simple system: lock exchange of equal-viscosity fluids in a horizontal, vertically confined layer of permeable rock. We show that the flow exhibits five regimes: (i) an early diffusion regime, in which the fluids diffuse across the initially sharp fluid–fluid interface; (ii) an S-slumping regime, in which the fluid–fluid interface tilts in an S-shape; (iii) a straight-line slumping regime, in which the fluid–fluid interface tilts as a straight line; (iv) a Taylor-slumping regime, in which Taylor dispersion at the aquifer scale enhances mixing between the fluids and causes the flow to continuously decelerate; and (v) a late diffusion regime, in which the flow becomes so slow that mass transfer again occurs dominantly though diffusion.