Sometimes the protagonist will wake up and find out that it was All Just a Dream. This is a slightly darker take that shows up in speculative fiction that deals with Time Travel, Reality Warping and alternate realities; the events really took place, but some key For Want of a Nail near the beginning must be undone to resolve the plot's key conflict. It could be the solution to ending a "Groundhog Day" Loop (as opposed to getting the loop perfect), a matter of realizing that a single trip was a case of Make Wrong What Once Went Right, or it could just be a case of the option to Ret Gone everything coming up in the finale. Reasons can include Balancing Death's Books, preventing a Time Paradox, or simply discovering that the unintended consequences of the event in question outweigh the good it does. More often than not, the event in question is the same one that brought about said conflict, making this an odd sort of Cutting the Knot solution.
This can be treated as utterly tragic, since it undoes Character Development, and may even be a sadistic choice (the "nail" in question is often some sort of tragedy, such as the protagonist's death, or an innocent party they now have to personally harm). Other times it has a slightly more optimistic spin, with it being implied that some of the nicer events that transpired will take place In Spite of a Nail (a slightly awkward scene of the main character befriending a character, especially a Love Interest, who they no longer know is a popular one). In worse cases, it might even be All for Nothing, with it implied that the catastrophe that was averted could easily happen again (and the next people to experience it might be more selfish).
The thing that it turns out must be reversed to retcon away the events is typically an Inciting Incident.
Writers must be quite careful with this trope, since as with All Just A Dream, it runs the risk of making it seem like the entire plot was pointless. This is avoidable if a Ripple Effect-Proof Memory allows them to retain Character Development (although, this invokes a bit of Fridge Logic if the issue was that time travel inherently damaged the timeline; something's changed either way) or otherwise benefit in some metaphysical way which prevents the audience from feeling cheated, or if the entire plot involved multiple loops anyway (so the audience is used to large chunks of plot not being canon in the main timeline).
Compare Set Right What Once Went Wrong, where undoing a specific event is the overall goal (which might lead to this trope), The Greatest Story Never Told (which happened, but was simply kept secret), Victory-Guided Amnesia (the events happened, but memories of them were erased) and Reset Button Ending, which returns the work to its Status Quo without resolving the conflict on its own (and doesn't always include altering history). Contrast All Just a Dream, where the events are revealed to simply never have happened, "Leave Your Quest" Test where undoing everything would be seen as a copout on the heroes' part, and Stable Time Loop, where changes to the timeline are either inevitable or meshed in perfectly (although it's still possible to run into the "bad outweighs the good" problem).
Note: This is a Spoilered Rotten trope, that means that EVERY SINGLE EXAMPLE on this list is a spoiler by default and most of them will be unmarked. This is your last warning, only proceed if you really believe you can handle this list.
- In The Infinity Gauntlet saga, Thanos managed to get the Infinity Gauntlet, a powerful Applied Phlebotinum that can modify everything, so he erased the half of sentient life of the universe to please Ms. Death, among other things like defeating the Cosmic Entities of the Marvel Universe. After the battle against the Mad God, finally Adam Warlock got the infinity Gauntlet from Thanos and used to Set Right What Once Went Wrong by restoring all the lives lost in the event (not just the ones erased by Thanos, also the deaths of heroes battling Thanos) and also managed to convince everyone in the universe that it was All Just a Dream.
- In Adventure Time, the "Dungeon Master" arc ends up with its entire timeline being erased from history as a side-effect of destroying the Eldritch Abominations that were its villains.
- Quantum Starlight (a My Little Pony: Friendship is Magic fanfic and Whole Plot Reference to Quantum Break): an accident during the first test of a Time Machine causes time itself to fracture, leading to a whole mess of unchangeable Stable Time Loops and the looming threat of a Time Crash. And then the protagonists find a method of time travel that does allow them to change the past, so they go back and stop the original accident. The majority of the plot is erased from the timeline, but the time travelers retain their memories of events retconned away.
- Lewis Robinson of Meet the Robinsons discovers the far future is an ugly dystopia where humanity is a Slave Race to mechanized overlords. Learning that it's one of his inventions that went rogue and begat this dystopia, Lewis gives a Death Glare to the Cyber Cyclops Big Bad and delivers the scathing Pre-Mortem One-Liner "... and I'm not inventing you!" Whereupon the device dissolves from existence, just before Lewis exploits the Timey-Wimey Ball to Set Right What Once Went Wrong.
- In the Director's Cut version of The Butterfly Effect, at the end the protagonist decides that the only way he can stop screwing things up with his Mental Time Travel is to jump back to before he was born, and strangle himself in his mother's womb; deleted scenes imply he wasn't even the first of his mother's children to go through this.
- Primer: when the power of Time Travel proves too dangerous and too confusing for anyone to use, Abe Terger travels back as far as he can and interferes with his past self's experiments, hoping to stop the past versions of himself and Aaron from pursuing time travel any further. The future versions of Abe and Aaron, who went through all that character development, continue existing—since time travel in Primer results in the travelers cloning themselves unless they're careful to maintain a Stable Time Loop.
- Not in an "Old Testament kind of mood" at the time, God in Jesus, Bro! decides to undo the rapture and the various deaths caused by Rick, Santa Christ and the Devil's actions in the film by resetting everything to before Elizabeth breaks up with Rick. Subverted, in that Santa Christ returns Rick's memories of everything that happened shortly after.
- In the finale of Donnie Darko, the titular protagonist goes back in time (somehow) and allows himself to be hit by the falling airplane engine that had missed him in the beginning, in order to change the sequence of events that led to his girlfriend being run over by a car.
- In Edge of Tomorrow, Major William Cage is stuck in a "Groundhog Day" Loop, where every time he dies fighting the alien Mimics, he wakes up the morning before the battle. Turns out this Mental Time Travel is a power he accidentally stole from an Alpha Mimic by contacting its blood. In the climax, Cage kills the Omega, the supreme leader of the Mimic Hive Mind, though he dies in the process. But the Omega has a souped-up version of the Alphas' power, and Cage gets its blood on him before he dies. Cage wakes up back in the very first scene of the movie—but this time, the Omega is dead, and all the other Mimics with it. And Cage is the only one who remembers the erased timelines; to everyone else, it looks like the alien invaders just died spontaneously.
- The Devil's Advocate: The movie ends with Kevin Lomax deciding to screw fate and killing himself to destroy the Devil's plans for world conquest. Then he suddenly finds himself back at the courthouse at the start of the movie before he made the decision that would lead to him meeting and ultimately working for the Devil. He chooses differently this time, thus undoing all the film's events, but it turns out that the Devil is still watching him anyway...
- In Artemis Fowl: The Lost Colony, Artemis and Holly, along with N°1 and Qwan (demon warlocks) are trapped in Limbo (a place outside of time) that Hybras (the Demon Island) is suspended in. But the spell holding Limbo there is unraveling causing time in the realm to warp all over the place, with constant past and future moments in the realm intersecting with the present. Artemis manages to figure out the pattern of the time jumps by observing the timer on a bomb that they had managed to drag along with them and they plan to use the energy of the kinetic bomb to power the spell. Leon Abbot however does not allow this, and draws his blade, slaughtering Holly and the warlocks. When he reaches Artemis he considers sparing the human, keeping him around as his pet and teach him tricks. But Artemis has a trick for Abbot, still keeping the count of the time jumps in his mind, he takes Holly's neutrino pistol and fires a laser bolt at the place where Abbot was about to stab Holly, just as the past intersects with the present, causing the laser bolt to get whipped into the past and hit Abbot before he stabs her. The present Abbot disappears while Holly and the warlocks get back up as if nothing had happened, because nothing had since Artemis had used the time jumping to prevent their murders from happening in the first place.
- Goosebumps: Be Careful What You Wish For: Samatha Byrd gets a gift of three wishes from the witch Clarissa. But, as expected, all these wishes come with terrible side effects. At the end, Samatha's uses her final request to wish that she had never met Clarissa.
- In the Megamorphs novel "Elfangor's Secret", Visser Four has used the Time Matrix to alter key events in human history to make the Yeerk invasion much easier. In order to undo the changes to the timeline (and Jake's death), the Animorphs ensure that Visser Four's host, John Berryman, was never born by preventing his parents from meeting, thus ensuring that Visser Four was never able to alter the timeline to begin with.
- In "The Forgotten", the Animorphs decide to steal a Yeerk Bug fighter in order to fly it to the White House and expose the Yeerk invasion, but an accident results in an anomaly known as a Sario Rip being created, where two alternate versions of each person involved exists at the same time and will be eliminated at a specific time, and also results in the Animorphs getting trapped in the Amazon rainforest along with Visser Three and his underlings. However, Jake gets killed by Visser Three before that time, thus returning him to the exact moment when he made the decision to steal the Bug fighter (as he is apparently the only real person there, as he's the only one to have vivid flashbacks to before his decision throughout the novel). This time, he decides not to go through with it.
- In David Eddings' Dreamers tetralogy, the fourth book describes a Deus ex Machina that one-ups the Physical Gods already present as viewpoint characters: the two amnesiac Old Gods remember their powers, effortlessly neutralize the Big Bad, and make their victory retroactive so the plot of the series never happened. Lampshaded, even, when they make a passing comment on all the Character Development that they unmade.
- The Star Trek: The Original Series episode "City on the Edge of Forever" ends with this trope implied. When McCoy gets drugged and falls through a mysterious portal through time, his changes to the timeline cause the Enterprise to disappear from the present. Kirk and Spock follow McCoy into the portal, arriving in New York City in The Thirties. They meet the peace activist Edith Keeler, and soon realize that she's the change in the timeline. McCoy saved her (or will soon save her) from an early death, and her activism will delay the USA's entry into World War II just long enough to lead to a Bad Future where Nazi Germany wins. So Kirk prevents McCoy from rescuing Keeler—erasing McCoy's involvement in the past and restoring the timeline to normal.
- In Legends of Tomorrow Season 2, after the Legends spend most of the season trying to keep The Spear of Destiny out of the hands of the Legion of Doom, ultimately they fail and the Legion uses the Spear to rewrite reality. Even trapped within the Legion's Doomworld reality, the Legends make a final attempt to steal back the spear and undo the damage, only for Eobard Thawne to destroy the spear itself. The Legends then reason that the only way to repair reality is to stop the Legion from getting the Spear to begin with, so they travel back in time across their own personal history to World War I where the Legion had first acquired the completed Spear. In a Final Battle of the Legends teaming up with their past selves to face the Legion, all of the future Legends end up being killed with the exception of Sara. Sara then uses the Spear's reality powers to disable its own reality warping before the Legion would use it, thus preventing the Legion from ever creating the Doomworld to begin with and restoring reality to its correct nature, but also breaking time in the process.
- Star Trek: Voyager: In a season-one episode, there's a time paradox centered on a polaron-based power grid on a pre-warp civilization's planet in the Delta Quadrant. Tom Paris and Captain Janeway end up falling through a hole in time that was caused by the power grid's accidental detonation. The twist is that the future-Voyager-crew's own attempt to rescue Paris and Janeway is what caused the detonation, and Janeway realizing this and using a phaser to stop the rescue attempt resets the timeline, preventing the detonation and in turn preventing them from going back in time in the first place.
- Doctor Who being a time travel show does this a fair bit:
- In "Father's Day", the Doctor takes Rose Tyler back to the day where her father, Pete, was killed so she could share one last moment with him just before he dies. However Rose disobeys the Doctor and saves her father's life by pushing him out of the way of the car that would kill him. As this was a fixed point in time, changing it causes catastrophic events on the world with the Reapers of Time being released to deal with the paradox. Ultimately, the one way to fix the anomaly is to have Pete relive the event that was changed and get hit by the car that would have killed him. Accepting his fate as the only way to restore time, Pete walks in front of the car and gets killed, erasing all of the alternate timeline that occurred due to the paradox.
- The Trope Namer where an event known as "The Year That Never Was" takes place. In the two-parter finale of Series 3 of the revival. The Master had succeeded in taking control over the entire world, trapping the Doctor in a Rapid Aging state, and Martha Jones on the run on the ground. The Master accomplished this by using a psychic Mind-Control Device to gradually work his way into being elected Prime Minister of Britain, before using an army of Toclafane (cyborg future human he had transported to the present) to cease control of the whole world. The Master would spend a year having his army gradually killing off the population of Earth, which was a Temporal Paradox since they were killing their ancestors. This is only made possible due to the Master turning the Doctor's TARDIS into a paradox machine. The Doctor ultimately manages to defeat the Master, by having Martha travel the Earth to every human survivor (linked with the Master's psychic device) and have them all think his name in unison, allowing the psychic energies to be granted to him. Once the Master is out of the way, the paradox machine is destroyed, causing the entire year of the Master's reign to reset back to before the paradox machine was activated. Only the select few people present near the machine retained memories of the year, while the rest of the population of the Earth were unaware of it occurring. This year came to be known as "The Year That Never Was".
- In "Journey to the Centre of the TARDIS", the TARDIS takes damage from a salvaging ship's magnetic cobble field. This causes all sorts of problems including Clara being trapped inside, moments from time seeping out, and zombie creatures roaming about the ship. Then to top it all off the TARDIS core is revealed to have hit critical and will eventually explode, with the zombie creatures revealed to be future versions of the TARDIS crew who had their flesh burned up and melted by the TARDIS. The Doctor eventually figures out the one way to repair the damage is to prevent the entire day from happening to begin with, which he does so by reaching through one of the tears in time to the point where the TARDIS got caught in the field and passes his past self the button to turn off the magnetic field, effectively erasing the entire day.
- At the climax of the Farscape episode "The Locket", the central characters are forced to use the strange properties of the Negative Space Wedgie that they are trapped in to reverse time and change history so that they never entered it. One of the two characters with a Ripple Effect-Proof Memory who remember this feels guilt that they might have erased a number of people who were conceived and born thanks to one of the crew having children on a planet on the other side of the anomaly, but the other speculates that they might have split the timeline instead of erasing it.
- As well as referencing the Star Trek example (as seen in the page quote), Life Is Strange has this twice itself; at the beginning of chapter 4, and for the entire game.
- Max realises she can jump back in time via photos (as well as just reversing it briefly as is done in normal gameplay) and tries to fix the death of Chloe's near angelic father. In the new timeline Chloe suffered a car accident instead and is dying a slow, painful death while confined to a wheelchair, suffering many of the bad things that were previously caused by her father's deathnote , culminating in a choice of whether you kill her with an overdose at her own request, or not. This is finally enough to make Max restore the original timeline, where Chloe is miserable and went through hell for the last 5 years, but is still alive. The entire scene is effectively foreshadowing for the endings...
- You first see Chloe when she's shot by Nathan, causing Max to manifest her Time Master powers and undo it in a Justified Tutorial. At the end of episode 5/Season 1 you have a Sadistic Choice of endings; "Sacrifice Chloe" or "Sacrifice Arcadia Bay". The former follows this trope, Max goes back in time (via a photo you took just before it happened) to let her get shot and Dying Alone (as far as she knows), never to be reunited with the former best friend crying her eyes out just feet away. A montage reveals that this also solves most of the story's other conflicts.note
- The other ending subverts this trope. Max tears the photo up (echoing an earlier moment when she destroys her prize winning photo to retcon herself back to the town and be able to save Chloe), having decided to Screw Destiny and let the storm that this damage to the timeline summoned destroy the town (with a Shrug of God as to how many survivors there are). After it subsides an unspecified amount of time later, Max and Chloe leave the ruined town together, moving on with their lives.
- Deponia Doomsday has a tangled story with time travel, time resetting and time loops that ultimately ends with Rufus convincing everybody that the tragic end of the previous game is the best option.
- Bastion has two endings. One is to leave the broken land and the other is to reset to before the calamity, without knowing if it will repeat or not. It's heavily hinted that it does indeed repeat (serving as an In-Universe explanation for a New Game+).
- Super Danganronpa 2 is all a computer simulation to retrain everyone to be better people. Well, at least that was the plan before Monokuma showed up and hijacked everything. A large part of the finale is about how to proceed with the situation, either undoing it all or letting the villain win. Despite all intents and plans, the reset turns out to somehow allow everyone to retain their memories and character developments, despite the timeline being thrown out.
- Ghost Trick ends with going back to When It All Began and undoing the initial death, erasing the entire timeline from that point forwards.
- Sonic the Hedgehog (2006) involved lots of time travel, and Dr. Eggman trying to harness the power of the god Solaris to conquer everything. Predictably, Solaris gets out of control and destroys almost all of time and space before Sonic and friends can stop him. The final cutscene involves one last bit of time travel, in which where Sonic and Elise extinguish the flame of Solaris, thereby preventing the lab accident that set the entire plot in motion. As the rest of the game wasn't very good, Sonic fans didn't particularly mind that it ended by erasing itself from the series timeline.
- At the end of The Legend of Zelda: Ocarina of Time, Zelda sends Link back to the past after apologizing for his quest preventing him from having a normal childhood. In doing so she actually failed to fully erase everything and created two timelines; one where Link simply vanished from existence after defeating Ganon as an adult, and one where he exposed the conspiracy as a child. Word of God is that despite being able to live out his childhood, Link retained memories of the events of the plot and lived an unfulfilled life because he never got to be the Hero of Time. However he managed to ease his regrets by passing on his knowledge to his successor as the Hero's Shade in The Legend of Zelda: Twilight Princess.
- The original Final Fantasy saw this happen upon the Light Warriors destroying Chaos and ending the cycle of Garland going back in time to become himnote . The ending text makes it clear that no one will remember the events of the game, since they never happened (the Fiends were defeated in the past before Garland could send them to the present), and that it's incumbent on the player to remember the events as the true arbiter of the legend.
- The plot of BioShock Infinite is driven by the conflict of the Player Character Booker DeWitt and the Big Bad Zachary Comstock over Comstock's daughter Elizabeth and her Dimensional Traveler powers. Towards the end of the game, it is revealed that Comstock is actually Booker himself who, in an alternate timeline, has had a religious conversion and changed his name, while Elizabeth was originally the player-controlled Booker's daughter Anna, who was taken to another dimension as a baby. After Elizabeth's power manifests fully, she realizes that the number of timelines is infinite and Booker becomes Comstock in about a half of them, so the only way to put an end to this conflict is by killing him just before the Comstock-Booker bifurcation occurs, effectively preventing the entire plot of the game from ever occurring, which she does with Booker's consent.
- At the end of Funny Business, when Jeanette learns that her Reality Warper powers are a result of her being the only real entity in the universe, and everybody else is but a figment of her imagination, and hence there is no reason for her depression and self-hatred, and everything she will ever do is completely pointless because nobody else exists to be affected by it, she eventually decides that the only way to deal with this is to Depower herself permanently and erase all of her memory of ever having had her powers to begin with. Because of how this universe’s cosmology works, this causes the world to spontaneously be recreated into one where other people indeed exist, Jeanette is a normal kid, and nothing in the story ever happened.
- Strange Bedfellows: Kronos decides to retcon the entire story by using god-powered time travel (which can only affect a few electrical impulses if you aim for twenty years ago) to prevent himself from inadvertently starting war between the Varkians and Sakkilians. Of course, a few outsiders were watching and decided to give a copy of the epic to Kronos after he and the others "woke up" from that strange dream... but anyone who ceased to exist is permanently unwritten from history.
- In "Anthology of Interest I", Fry asks the "What If?" Machine what would have happened if he hadn't been cryogenically frozen in 1999—that is, if the entire premise of the show were undone. Turns out this would cause a Time Paradox—because the future needs Fry for an unexplained reason—and this damage to the timeline attracts the attention of Al Gore and the Vice Presidential Action Squad. When they figure out that Fry needs to get frozen to save the timeline, Fry disbelieves them and breaks the freezer. The temporal paradox then implodes the entire universe—stranding Fry and the rest in a white void, with nothing to do but play play Dungeons & Dragons for the rest of eternity. Examples of the trope which tend to be a Shoot the Dog are also briefly parodied when Al Gore et al assume Fry was supposed to die, and get confused when trying to murder him doesn't fix anything.
- "The Why of Fry" teases at this. The brain spawn's last-ditch effort to destroy the universe is to send Fry (the only person capable of stopping them) back to 1999 to prevent himself from getting frozen. But Nibbler gives future-Fry a pep talk that convinces him that getting frozen and sent to the year 3000 is necessary. Fry instead makes a minor change that ensures he isn't in a position to be tempted by the brain spawn in the first place.
- In the Family Guy episode "Back to the Pilot", Brian asks for Stewie's help in finding a lost tennis ball. Stewie agrees to take Brian back in time so he can see the location, but Brian fails to listen ends up telling his past self about the 9/11 attacks. This results in an apocalyptic Bad Future from the result of nuclear attacks. After multiple trips result in dozens of Stewies and Brians from the future arguing it out on whether or not to prevent 9/11, one of the Stewies decides to hold a vote. Upon the majority agreeing to allow 9/11 to happen, this Stewie and Brian then travel one minute back in time to the very first point they arrived via time travel, before they made any changes. Stewie then draws a gun on the past Stewie and Brian and forces them to go back to the present. By doing so, Stewie managed to erase the entire timeline created by the time travel along with this version of Brian and Stewie.
- In the Justice League episode "Time, Warped", Batman tampers with the villain's time travel belt so that instead of going on his time traveling crime spree, as he did at the beginning of the previous episode, it locks him in a time loop at the point where he would have started. Ultimately, though, the events weren't completely negated: Green Lantern is left with a Ripple Effect-Proof Memory of a Kid from the Future who is not from the woman he was dating at the time.
- In The Batman an episode revolves around Francis Grey, a clock-repair man who, because of his family's dire financial straits, stole an expensive watch. This leads to a cavalcade of Disaster Dominoes which landed him 20 years in prison. After developing Time Master powers and using them to lash out with an Evil Plan, he accidentally kills his son. Then he supercharges his powers and goes back to the moment before he stole the watch—this time, wisely deciding to just work overtime instead. The episode ends as it began; with the Bat-Family discussing New Years resolutions, but a clock that Alfred had trouble repairing has been fixed by none other than Francis himself. The episode ends less than a few minutes after it chronologically started with Francis returning to his van labelled "Grey and Son, Watch Repair" to spend Christmas with his family.
- The sixth season of Ninjago, Skybound, ends in this when Jay uses his final wish from Nadakhan to make it so that no one ever released Nadakhan in the first place. Nadakhan, who is forced to oblidge and is unable to twist Jay's words due to being weakened from Tiger Widow venom, grants this wish, and everything reverts to the way it was at the beginning of the season (with the exception that Jay and Nya retain their memories of the experience).
- The Loud House: At the end of the episode "The Mad Scientist", Lisa uses her newly discovered time travel to undo everything that has happened in the episode and ensures it won’t happen again, with only her remembering the original timeline.