Amr bin As reported,

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.

Azami 4724

Sahih

عن عمرو بن العاص، قال

فلما جعل الله الإسلام في قلبي أتيت النبي ﷺ فقلت: ابسط يمينك فلأبايعك، فبسط يمينه قال: فقبضت يدي قال: ما لك يا عمرو؟ قال: قلت: أردت أن أشترط. قال: تشترط بماذا؟ قلت: أن يغفر لي، قال: أما علمت أن الإسلام يهدم ما كان قبله، وأن الهجرة تهدم ما كان قبلها، وأن الحج يهدم ما كان قبله. الحديث.

الأعظمي 4724صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Hajj
Chapter
Obligation of Hajj, its virtue, and its conditions
Section
Hajj erasing what came before it
Numbering
Jami al-Kamil 4724 (2nd edition)
Azami 4724