In Avengers: Endgame, the Avengers
went back in time to get the Stones and undo what Thanos did.
Is that what happened in the comics?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
No. The MCU's plot's are inspired by the comics, but are not direct adaptations.
The closest to Infinity War/Endgame is the 1991 six-issue The Infinity Gauntlet. As Wikipedia summarises:
When Thanos uses his powers to kill half of the living beings in the universe, Adam Warlock leads Earth's remaining heroes against him. After the Infinity Gauntlet is stolen by Thanos' villainous granddaughter Nebula, Thanos aids the remaining heroes in defeating her. Warlock ultimately obtains the Infinity Gauntlet and uses its power to undo the death and destruction caused by Thanos.
So there's no time travel at all. The gauntlet is simply stolen a couple of times and then used.