Abu Qatada reported,

He heard him narrate from the Messenger of Allah ﷺ that he stood among them and told them that jihad in the path of Allah and faith in Allah are the best of deeds.A man stood up and asked, "Messenger of Allah, tell me, if I am killed in the path of Allah, will my sins be wiped away?"The Messenger of Allah ﷺ replied, "Yes, if you are killed in the path of Allah while patient, seeking reward, advancing and not retreating."Then the Messenger of Allah ﷺ asked, "What did you say?"The man repeated, "Tell me, if I am killed in the path of Allah, will my sins be wiped away?"The Messenger of Allah ﷺ answered, "Yes, provided you are patient, seeking reward, advancing and not retreating, except for debt. For Jibreel عليه السلام told me that."

Azami 8099

Sahih

عن أبي قتادة

أنه سمعه يحدث عن رسول الله ﷺ أنه قام فيهم فذكر لهم: أن الجهاد في سبيل الله والإيمان بالله أفضل الأعمال، فقام رجل فقال: يا رسول الله أرأيت إن قتلت في سبيل الله تكفر عني خطاياي؟ فقال له رسول الله ﷺ: نعم إن قتلت في سبيل الله وأنت صابر محتسب مقبل غير مدبر ثم قال رسول الله ﷺ كيف قلت؟ قال: أرأيت إن قتلت في سبيل الله أتكفر عني خطاياي؟ فقال رسول الله ﷺ: نعم وأنت صابر محتسب مقبل غير مدبر إلا الدين، فإن جبريل عليه السلام قال لي ذلك.

الأعظمي 8099صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Jihad
Chapter
Martyrs and the rulings on martyrdom
Section
Martyr is forgiven every sin except debt
Numbering
Jami al-Kamil 8099 (2nd edition)
Azami 8099