Abu Qatadah (May Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) stood up among his Companions and said, "Jihad in the way of Allah and belief in Allah (with all His Attributes) are the most meritorious of actions." A man stood up and said: "O Messenger of Allah! Inform me if I am killed in the way of Allah, will my sins be blotted out?" The Messenger of Allah (ﷺ) said, "Yes, in case you are killed in the way of Allah and you remained patient, hopeful of reward, and advancing forward without retracing back (i.e., while fighting)." Then he said, "What was your question?" He inquired again: "Inform me, if I am killed in the way of Allah, will all my sins be blotted out?" The Messenger of Allah (ﷺ) replied, "If you remained patient, hopeful of reward and always fought without turning your back upon enemy, everything, except debt, will be forgiven. Jibril has told me this."[Muslim].
App reference: Book 12, Hadith 29
Arabic/English book reference: Book 12, Hadith 1313