Feynman's multifaceted contributions to gravitation, as can be inferred from several published and unpublished sources, are here reviewed. Feynman thought about this subject at least from late 1954 to the late '60s, giving several pivotal contributions to it, and as a byproduct, also to Yang-Mills theory. Even though he only published three papers on gravity, much more material is available, especially the records of his many interventions at the Chapel Hill conference in 1957, which are here analyzed in detail. In that conference, Feynman showed that he had already developed much of his picture of gravity, and in addition he expressed deep thoughts about fundamental issues in quantum mechanics, such as superpositions of the wave functions of macroscopic objects and the role of the observer, which were suggested by the problem of quantum gravity. Moreover, Feynman lectured on gravity several times. Besides the famous lectures given at Caltech in 1962-63, he extensively discussed this subject in a series of lectures given at the Hughes Aircraft Company in 1966-67, whose focus was astronomy and astrophysics. Here Feynman gave a somewhat simplified exposition with respect to the Caltech lectures, but with many original points. All this material allows to reconstruct a detailed picture of Feynman's ideas on gravity and of its evolution until the late sixties. The main points are that gravity, like electromagnetism, has a quantum foundation, so that classical general relativity has to be regarded as emerging from an underlying quantum theory in the classical limit, and that this quantum theory has to be investigated by computing physical processes, as if they were easily measurable. The same attitude is shown with respect to gravitational waves, as evident both from the Chapel Hill records and an unpublished letter written to V. Weisskopf. As a bonus, an original approach to gravity, which closely mimics (and probably was inspired by) the derivation of the Maxwell equations he gave in that period, is hinted at in the unpublished lectures.