Ganesha in the Shivapurana
The Shivapurana gives the following version of Ganesha’s birth:
(IV, 13.15) Once when Parvati was taking her bath, Sadashiva [Shiva] rebuked Nandin [the door keeper] and came into the inner apartment. The mother of the universe, seeing the untimely arrival of Shiva in the midst of her bath and toilette stood up. The beautiful lady was very shy then. [...] At the time the incident occurred, Parvati, the great Maya, the great goddess, thought, “There must be a servant of my own who will be expert in his duties. He must not stray from my behest even a speck.” Thinking thus, the goddess created a person with all these characteristics, out of the dirt from her body. He was spotless and handsome in every part of his body. He was huge in size and had all brilliance, strength and valour. She gave him various clothes and ornaments. She blessed him with benediction and said “You are my son. You are my own. I have no one else to call my own.” (Shivapurana, IV, Kumarakhanda, 13.15-13.23)
The text goes on to tell how Parvati placed Ganesha in front of her door and asked him to forbid anyone to enter. Shiva came and was rebuffed by Parvati’s son. He then sent his followers, the ganas, to fight the boy, but they were defeated by Ganesha. Furious, Shiva came back with an army of gods. While Ganesha was fighting Vishnu, Shiva seized the opportunity and cut off Ganesha’s head with his trident. Sad and furious, Parvati created her own army and threatened to annihilate the world. The gods came to her and asked her for forgiveness, for the sake of the world. Below find Parvati’s reply, and how Ganesha was resuscitated with an elephant’s head.
(IV, 17.42) “If my son regains life there may not be further annihilation. If you can arrange for him an honourable status and position among you as the chief presiding officer, there may be peace in the world. Otherwise you will never be happy.” [...] Shiva spoke thus: “It shall be done accordingly so that there may be peace over all the worlds. You [the gods] shall go in the northern direction and, whatever person you meet first, cut off his head and fit it to this body.” Then they [the gods] carried out Shiva’s behests and acted accordingly. They took the headless body of Ganesha and washed it well. They paid homage to it and started towards the north. It was a single-tusked elephant that they met. They took the head and fitted it to the body. [...] They jointly sprinkled the holy water [...] Immediately after the contact of the holy water the boy was resuscitated and joined with consciousness. As Shiva willed, the boy woke up from a sleep. [...] On seeing him restored to life, the goddess was greatly delighted. [...] After pleasing her, they placed the boy in her lap for the happiness of the three worlds. Placing his lotus-like hand on his head, Shiva told the gods “This is another son of mine”. (Shivapurana, IV, Kumarakhanda, 17.42-18.17)