The European Space Agency's Gaia mission is revolutionising our understanding on how the Milky Way, the spiral galaxy we inhabit, has formed and evolved. Gaia is measuring the apparent luminosities, colours, positions, motions, and the chemical composition of an unprecedentedly large number of individual stars in our Galaxy. In particular, combining apparent luminosities with distances to these stars, here we have computed the intrinsic luminosity of 24 million stars within a sphere of 6500 light years around our Sun. Comparing such luminosities and colours with accurate models of stars we have obtained the most detailed evolutionary history of the Milky Way up to now. According to our findings, some 13 billion years ago star formation was violent and sustained in the Milky Way, but the rate at which stars formed declined gradually as time passed. Superposed to this simple behaviour, dramatic episodes of star formation appeared. During these episodes the rate grew up to four times the normal value. The first of these enhancements took place some 5-6 billion years ago, followed by others, 2 billion, one billion, and one hundred million years ago. But, what could have caused these violent events in a system as massive as our Galaxy? The Milky Way, the Andromeda galaxy (M31) and tens of much smaller galaxies (called dwarfs and that are orbiting the two more massive systems) form the so-called Local Group. One of such small galaxies is the Sagittarius dwarf galaxy, a galaxy that is in fact currently interacting with our Galaxy. Complex simulations suggest that this is not the first time that both galaxies are so close to each other. It seems that this already happened some 5 to 6 billion years ago, when Sagittarius made its first approach to the Milky Way, and it was repeated 2 and 1 billion years ago, coinciding exactly with the star formation events revealed in this study. Everything indicates that these interactions between these two systems were able to stimulate the formation of new stars in our galaxy, drastically affecting its evolution. These results question some of the current models of star formation in galaxies, and put constraints on future theoretical studies. But not only this. Given that the age of the Sun and our solar System - around 4.7 billion years - roughly coincides with the extension of the first of these star formation enhancements, one could speculate with the possibility that our own Sun was one of the many stars formed as a consequence of the interaction between our Galaxy and the Sagittarius (Sgr) dwarf galaxy.