Abdullah bin Masud reported,

A man asked, "Messenger of Allah, will we be held accountable for what we did in the days of ignorance?"He replied, "Whoever does well in Islam will not be held accountable for what he did in the days of ignorance, but whoever does evil in Islam will be held accountable for both the former and the latter."

Azami 174

Sahih

عن ابن مسعود قال

قال رجل: يا رسول الله أنواخذ بما عملنا في الجاهلية؟ قال: من أحسن في الإسلام لم يؤاخذ بما عمل في الجاهلية، ومن أساء في الإسلام أخذ بالأول والآخر.

الأعظمي 174صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Qualities of faith
Section
Islam destroying what came before it
Numbering
Jami al-Kamil 174 (2nd edition)
Azami 174