Sahih al-Bukhari 2538
Narrated Hisham:
My father told me that Hakim bin Hizam manumitted one-hundred slaves in the pre-lslamic period of ignorance and slaughtered one-hundred camels (and distributed them in charity). When he embraced Islam he again slaughtered one-hundred camels and manumitted one-hundred slaves. Hakim said, "I asked Allah's Apostle, 'O Allah's Apostle! What do you think about some good deeds I used to practice in the prelslamic period of ignorance regarding them as deeds of righteousness?' Allah's Apostle ﷺ said, "You have embraced Islam along with all those good deeds you did."
حَدَّثَنَا عُبَيْدُ بْنُ إِسْمَاعِيلَ، حَدَّثَنَا أَبُو أُسَامَةَ، عَنْ هِشَامٍ، أَخْبَرَنِي أَبِي أَنَّ حَكِيمَ بْنَ حِزَامٍ ـ رضى الله عنه ـ أَعْتَقَ فِي الْجَاهِلِيَّةِ مِائَةَ رَقَبَةٍ، وَحَمَلَ عَلَى مِائَةِ بَعِيرٍ، فَلَمَّا أَسْلَمَ حَمَلَ عَلَى مِائَةِ بَعِيرٍ وَأَعْتَقَ مِائَةَ رَقَبَةٍ، قَالَ فَسَأَلْتُ رَسُولَ اللَّهِ ﷺ فَقُلْتُ يَا رَسُولَ اللَّهِ، أَرَأَيْتَ أَشْيَاءَ كُنْتُ أَصْنَعُهَا فِي الْجَاهِلِيَّةِ، كُنْتُ أَتَحَنَّثُ بِهَا، يَعْنِي أَتَبَرَّرُ بِهَا، قَالَ فَقَالَ رَسُولُ اللَّهِ ﷺ " أَسْلَمْتَ عَلَى مَا سَلَفَ لَكَ مِنْ خَيْرٍ ".