What are the things that forgive major sins?
Becoming Muslim, Hajj, and hijrah (migration).
There are three actions that the Prophet (peace be upon him) said do away with major sins.
This is a hadith of Amr ibn Al-As, when he became Muslim:
There are three things that do away with everything before them: entering into Islam, doing hajj, or migrating for the sake of Allah.
Now, here’s the thing, let’s say that you don’t have the opportunity to do those three things like should I go away from Islam, and then become Muslim again so I can get that one? It seems pretty easy just come back and take shahadah the next day…
It doesn’t work that way. You might die in between them. But the Prophet (peace be upon him) also teaches us that sincere repentance can do away with anything.
This is the full hadith:
It is narrated on the authority of Ibn Shamasa Mahri that he said:
We went to Amr ibn al-As and he was about to die. He wept for a long time and turned his face towards the wall. His son said:
“Did the Messenger of Allah (may peace be upon him) not give you tidings of this? Did the Messenger of Allah not give you tidings of this?”
He (the narrator) said: He turned his face (towards the audience) and said:
“The best thing which we can count upon is the testimony that there is no god but Allah and that Muhammad is the Messenger of Allah.
Verily I have passed through three phases. (The first one) in which I found myself averse to none else more than I was averse to the Messenger of Allah and there was no other desire stronger in me than the one that I should overpower him and kill him. Had I died in this state, I would have been definitely one of the denizens of Fire.
When Allah instilled the love of Islam in my heart, I came to the Apostle and said:
‘Stretch out your right hand so that may pledge my allegiance to you.’
He stretched out his right hand, I withdrew my hand, He (the Holy Prophet) said:
“What has happened to you, O ‘Amr?”
‘I intend to lay down some condition.’
“What condition do you intend to put forward?”
‘Should be granted pardon.’
He (the Holy Prophet) observed:
Are you not aware of the fact that Islam wipes out all the previous (misdeeds)? Verily migration wipes out all the previous (misdeeds), and verily the pilgrimage wipes out all the (previous) misdeeds… (Muslim)