Global temperature is affected by a lot of things, not just humans and their greenhouse gases. We know what some of those things are, and we can even estimate their impact over the last 40 years or so (since 1979 let’s say). Then we can subtract that effect from temperature data, to estimate how hot Earth would have been without those “other things.”
What other things, you wonder? Known factors include the El NiƱo Southern Oscillation (ENSO), volcanic eruptions, and variations in the output of the sun; published research outlines the method I used (although I’ve tweaked it a bit). Let’s take, for instance, the global temperature from NASA (monthly averages from January 1979 through December 2019):