When Allah placed Islam in my heart, I came to the Prophet ﷺ and said, "Extend your right hand so that I may pledge allegiance to you."He extended his hand, but I withdrew mine.He asked, "What is the matter, Amr?"I replied, "I wanted to make a condition."He asked, "What condition?"I said, "That I be forgiven."He said, "Do you not know that Islam wipes out what came before it, that migration wipes out what came before it, and that pilgrimage wipes out what came before it?"The hadith continues.
فلما جعل الله الإسلام في قلبي أتيت النبي ﷺ فقلت: ابسط يمينك فلأبايعك، فبسط يمينه قال: فقبضت يدي قال: ما لك يا عمرو؟ قال: قلت: أردت أن أشترط. قال: تشترط بماذا؟ قلت: أن يغفر لي، قال: أما علمت أن الإسلام يهدم ما كان قبله، وأن الهجرة تهدم ما كان قبلها، وأن الحج يهدم ما كان قبله. الحديث.
Muslim narrated it in the Book of Faith (121) in a lengthy context through several chains from Abu Asim Dahhak, who said, Haywa bin Shurayh informed us, he said, Yazid bin Abu Habib narrated to me, from Ibn Shumasa Mahri, who said, We attended Amr bin As while he was in the throes of death... and he related it in full.