It is narrated from Sayyiduna Amr bin Aas (may Allah be pleased with him), he says: When Allah Almighty put the thought of Islam into my heart, I came to the Noble Prophet (peace and blessings be upon him) to pledge allegiance, and the Prophet (peace and blessings be upon him) extended his hand towards me, but at that moment I said: "I will not pledge allegiance to you until my previous sins are forgiven." The Messenger of Allah (peace and blessings be upon him) said: "Amr! Do you not know that migration wipes out previous sins? Amr! Do you not know that Islam also erases previous sins?"
Hadith Referenceالفتح الربانی / كتاب الإيمان و الإسلام / 117
Hadith Gradingمحدثین:صحیح
Hadith Takhrij«اسناده صحيح علي شرط مسلم ، (انظر مسند أحمد ترقيم الرسالة: 17827 ترقیم بيت الأفكار الدولية: 17981»
Brief Explanation
Benefits: … The command of Allah, the Exalted, is: {قُلْلِّلَّذِیْنَکَفَرُوْااِنْیَّنْتَھُوْایُغْفَرْلَھُمْمَاقَدْسَلَفَ} … Say to the disbelievers that if they desist, then all their previous sins will be forgiven. (Surah Al-Anfal: 38)
It is understood from this that due to Islam and migration (hijrah), previous sins are forgiven. Further details are forthcoming.