"O Messenger of Allah, if I am killed in the cause of Allah, will Allah forgive my sins?" The Messenger of Allah (ﷺ) said: "Yes, if you are killed in the cause of Allah, and you are patient and seek reward, and you are facing the enemy, not running way - except for debt. Jibril (peace be upon him) told me that."
Sunan an-Nasa'i Book 25, Hadith 73