In young dense clusters repeated collisions between massive stars may lead to the formation of a very massive star (above 100 Msun). In the past the study of the long-term evolution of merger remnants has mostly focussed on collisions between low-mass stars (up to about 2 Msun) in the context of blue-straggler formation. The evolution of collision products of more massive stars has not been as thoroughly investigated. In this paper we study the long-term evolution of a number of stellar mergers formed by the head-on collision of a primary star with a mass of 5-40 Msun with a lower mass star at three points in its evolution in order to better understand their evolution. We use smooth particle hydrodynamics (SPH) calculations to model the collision between the stars. The outcome of this calculation is reduced to one dimension and imported into a stellar evolution code. We follow the subsequent evolution of the collision product through the main sequence at least until the onset of helium burning. We find that little hydrogen is mixed into the core of the collision products, in agreement with previous studies of collisions between low-mass stars. For collisions involving evolved stars we find that during the merger the surface nitrogen abundance can be strongly enhanced. The evolution of most of the collision products proceeds analogously to that of normal stars with the same mass, but with a larger radius and luminosity. However, the evolution of collision products that form with a hydrogen depleted core is markedly different from that of normal stars with the same mass. They undergo a long-lived period of hydrogen shell burning close to the main-sequence band in the Hertzsprung-Russell diagram and spend the initial part of core helium burning as compact blue supergiants.