In the Wishverse, Rupert Giles was an ex-Watcher and the leader of the so-called White Hats, a group of vampire hunters. Having learned about the 'real' world from Cordelia Chase—before she was killed—he contacted this reality's Buffy for assistance, but when she left to fight The Master, showing no interest in his theories about how to change the world, he attempted to summon Anyanka, having identified her as the demon who had granted Cordelia's wish that Buffy never came to Sunnydale, in an attempt to restore the timeline to normal. In the subsequent confrontation with Anyanka, she asked him how he could be so sure that the other world was any better than this one. Giles simply replied "Because it has to be" before he smashed Anyanka's pendant, ending the wish and restoring reality to normal, albeit with Anyanka now powerless and mortal.
It was unknown why Giles was present in Sunnydale without a Slayer to train. Cordelia inquired about this, but they were interrupted by Xander and Willow before Giles could answer. (Possibly, given Angel's presence there, Buffy was expected to move to Sunnydale before something happened to change Joyce's plans, with Giles being sent there by The Council in preparation for her presence and subsequently remaining.)