Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:18290Abū ʿAbdullāh al-Ḥāfiẓ > Abū al-ʿAbbās al-Aṣam > Aḥmad b. ʿAbd al-Jabbār > Yūnus b. Bukayr > Ibn Isḥāq > Yazīd b. Abū Ḥabīb > Rāshid a freed slave of Ḥabīb > Ḥabīb b. Abū Aws > ʿAmr

[Machine] Then I stepped forward and said, "O Messenger of Allah, I pledge allegiance to you on the condition that my previous sins are forgiven and I will not mention what comes after." He said to me, "O 'Amr, pledge allegiance, for Islam cancels out what came before it and migration cancels out what came before it." So I pledged allegiance to him.  

البيهقي:١٨٢٩٠أَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ ثنا أَبُو الْعَبَّاسِ الْأَصَمُّ ثنا أَحْمَدُ بْنُ عَبْدِ الْجَبَّارِ ثنا يُونُسُ بْنُ بُكَيْرٍ عَنِ ابْنِ إِسْحَاقَ حَدَّثَنِي يَزِيدُ بْنُ أَبِي حَبِيبٍ عَنْ رَاشِدٍ مَوْلَى حَبِيبٍ عَنْ حَبِيبِ بْنِ أَبِي أَوْسٍ قَالَ حَدَّثَنِي عَمْرُو بْنُ الْعَاصِ ؓ فَذَكَرَ الْحَدِيثَ فِي قِصَّةِ إِسْلَامِهِ قَالَ

ثُمَّ تَقَدَّمْتُ فَقُلْتُ يَا رَسُولَ اللهِ أُبَايِعُكَ عَلَى أَنْ يُغْفَرَ لِي مَا تَقَدَّمَ مِنْ ذَنْبِي وَلَمْ أَذْكُرْ مَا تَأَخَّرَ فَقَالَ لِي يَا عَمْرُو بَايِعْ فَإِنَّ الْإِسْلَامَ يَجُبُّ مَا كَانَ قَبْلَهُ وَإِنَّ الْهِجْرَةَ تَجُبُّ مَا كَانَ قَبْلَهَا فَبَايَعْتُهُ