Hadith on Islam: New Muslims keep all previous good deeds

Hakim ibn Hazim reported: He said, “O Messenger of Allah, what do you think of my good deeds which I did in the time of ignorance, such as upholding family ties, freeing my slaves, and giving charity. Will I receive their reward?” The Messenger of Allah, peace and blessings be upon him, said, “You have embraced Islam along with the good you have done.”

Source: Ṣaḥīḥ al-Bukhārī 5646

Grade: Sahih (authentic) according to Al-Bukhari

عن حَكِيم بْن حِزَامٍ قَالَ يَا رَسُولَ اللَّهِ قَالَ يَا رَسُولَ اللَّهِ أَرَأَيْتَ أُمُورًا كُنْتُ أَتَحَنَّثُ بِهَا فِي الْجَاهِلِيَّةِ مِنْ صِلَةٍ وَعَتَاقَةٍ وَصَدَقَةٍ هَلْ لِي فِيهَا مِنْ أَجْرٍ  قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ أَسْلَمْتَ عَلَى مَا سَلَفَ مِنْ خَيْرٍ

5646 صحيح البخاري كتاب الأدب باب من وصل رحمه في الشرك ثم أسلم