This review addresses our current understanding of comets that venture close to the Sun, and are hence exposed to much more extreme conditions than comets that are typically studied from Earth. The extreme solar heating and plasma environments that these objects encounter change many aspects of their behaviour, thus yielding valuable information on both the comets themselves that complements other data we have on primitive solar system bodies, as well as on the near-solar environment which they traverse. We propose clear definitions for these comets: We use the term near-Sun comets to encompass all objects that pass sunward of the perihelion distance of planet Mercury (0.307 AU). Sunskirters are defined as objects that pass within 33 solar radii of the Sun's centre, equal to half of Mercury's perihelion distance, and the commonly-used phrase sungrazers to be objects that reach perihelion within 3.45 solar radii, i.e. the fluid Roche limit. Finally, comets with orbits that intersect the solar photosphere are termed sundivers. We summarize past studies of these objects, as well as the instruments and facilities used to study them, including space-based platforms that have led to a recent revolution in the quantity and quality of relevant observations. Relevant comet populations are described, including the Kreutz, Marsden, Kracht, and Meyer groups, near-Sun asteroids, and a brief discussion of their origins. The importance of light curves and the clues they provide on cometary composition are emphasized, together with what information has been gleaned about nucleus parameters, including the sizes and masses of objects and their families, and their tensile strengths. The physical processes occurring at these objects are considered in some detail, including the disruption of nuclei, sublimation, and ionisation, and we consider the mass, momentum, and energy loss of comets in the corona and those that venture to lower altitudes. The different components of comae and tails are described, including dust, neutral and ionised gases, their chemical reactions, and their contributions to the near-Sun environment. Comet-solar wind interactions are discussed, including the use of comets as probes of solar wind and coronal conditions in their vicinities. We address the relevance of work on comets near the Sun to similar objects orbiting other stars, and conclude with a discussion of future directions for the field and the planned ground- and space-based facilities that will allow us to address those science topics.