(100) باب شِرَاءِ الْمَمْلُوكِ مِنَ الْحَرْبِيِّ وَهِبَتِهِ وَعِتْقِهِ
Narrated `Urwa bin Az-Zubair:
Hakim bin Hizam said, "O Allah's Messenger (ﷺ)! I used to do good deeds in the Pre-Islamic period of Ignorance, e.g., keeping good relations with my Kith and kin, manumitting slaves and giving alms. Shall I receive a reward for all that?" Allah's Messenger (ﷺ) replied, "You embraced Islam with all the good deeds which you did in the past."
Reference: Sahih al-Bukhari 2220
In-book reference: Book 34, Hadith 167
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 3, Book 34, Hadith 423