Sahih Muslim , Hadith 1885

It has been narrated on the authority of Abu Qatada that the Messenger of Allah stood up among them (his Companions) to deliver his sermon in which he told them that Jihad in the way of Allah and belief in Allah (with all His Attributes) are the most meritorious of acts. A man stood up and said: Messenger of Allah, do you think that if I am killed in the way of Allah, my sins will be blotted out from me? The Messenger of Allah said: Yes, in case you are killed in the way of Allah and you were patient and sincere and you always fought facing the enemy, never turming your back upon him. Then he added: What have you said (now)? (Wishing to have further assurance from him for his satisfaction), he asked (again): Do you think if I am killed in the way of Allah, all my sins will be obliterated from me? The Messenger of Allah said: Yes, it you were patient and sincere and always fought facing the enemy and never turning your back upon him, (all your lapses would be forgiven) except debt. Gabriel has told me this.

حَدَّثَنَا قُتَيْبَةُ بْنُ سَعِيدٍ، حَدَّثَنَا لَيْثٌ، عَنْ سَعِيدِ بْنِ أَبِي سَعِيدٍ، عَنْ عَبْدِ اللَّهِ بْنِ أَبِي، قَتَادَةَ عَنْ أَبِي قَتَادَةَ، أَنَّهُ سَمِعَهُ يُحَدِّثُ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم أَنَّهُ قَامَ فِيهِمْ فَذَكَرَ لَهُمْ ‏"‏ أَنَّ الْجِهَادَ فِي سَبِيلِ اللَّهِ وَالإِيمَانَ بِاللَّهِ أَفْضَلُ الأَعْمَالِ ‏"‏ ‏.‏ فَقَامَ رَجُلٌ فَقَالَ يَا رَسُولَ اللَّهِ أَرَأَيْتَ إِنْ قُتِلْتُ فِي سَبِيلِ اللَّهِ تُكَفَّرُ عَنِّي خَطَايَاىَ فَقَالَ لَهُ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ نَعَمْ إِنْ قُتِلْتَ فِي سَبِيلِ اللَّهِ وَأَنْتَ صَابِرٌ مُحْتَسِبٌ مُقْبِلٌ غَيْرُ مُدْبِرٍ ‏"‏ ‏.‏ ثُمَّ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ كَيْفَ قُلْتَ ‏"‏ ‏.‏ قَالَ أَرَأَيْتَ إِنْ قُتِلْتُ فِي سَبِيلِ اللَّهِ أَتُكَفَّرُ عَنِّي خَطَايَاىَ فَقَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ نَعَمْ وَأَنْتَ صَابِرٌ مُحْتَسِبٌ مُقْبِلٌ غَيْرُ مُدْبِرٍ إِلاَّ الدَّيْنَ فَإِنَّ جِبْرِيلَ عَلَيْهِ السَّلاَمُ قَالَ لِي ذَلِكَ ‏"‏ ‏.‏

sunnah.com

The tradition has been narrated through a different chain of transmitters on the authority of Abu Qatada who said: A man came to the Messenger of Allah while he was on the pulpit and said: Do you think if I am killed in the way of Allah... (except this difference in its beginning, the rest of the tradition is the same as the previous one).

حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَمُحَمَّدُ بْنُ الْمُثَنَّى، قَالاَ حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، أَخْبَرَنَا يَحْيَى، - يَعْنِي ابْنَ سَعِيدٍ - عَنْ سَعِيدِ بْنِ أَبِي سَعِيدٍ الْمَقْبُرِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ أَبِي قَتَادَةَ، عَنْ أَبِيهِ، قَالَ جَاءَ رَجُلٌ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ أَرَأَيْتَ إِنْ قُتِلْتُ فِي سَبِيلِ اللَّهِ بِمَعْنَى حَدِيثِ اللَّيْثِ ‏.‏

sunnah.com

Another version of the tradition differently transmitted begins with the words: " A man came to the Messenger of Allah and he was sitting on the pulpit.... He said: What do you find if I strike with the sword?" (The rest of the tradition is the same as the previous one.)

وَحَدَّثَنَا سَعِيدُ بْنُ مَنْصُورٍ، حَدَّثَنَا سُفْيَانُ، عَنْ عَمْرِو بْنِ دِينَارٍ، عَنْ مُحَمَّدِ بْنِ قَيْسٍ، ح قَالَ وَحَدَّثَنَا مُحَمَّدُ بْنُ عَجْلاَنَ، عَنْ مُحَمَّدِ بْنِ قَيْسٍ، عَنْ عَبْدِ اللَّهِ بْنِ أَبِي قَتَادَةَ، عَنْ أَبِيهِ، عَنِ النَّبِيِّ صلى الله عليه وسلم يَزِيدُ أَحَدُهُمَا عَلَى صَاحِبِهِ أَنَّ رَجُلاً أَتَى النَّبِيَّ صلى الله عليه وسلم وَهُوَ عَلَى الْمِنْبَرِ فَقَالَ أَرَأَيْتَ إِنْ ضَرَبْتُ بِسَيْفِي ‏.‏ بِمَعْنَى حَدِيثِ الْمَقْبُرِيِّ ‏.‏

sunnah.com