The Messenger of Allah ﷺ said, "Allah has guaranteed for the one who goes out in His path, whom nothing brings out except striving in My path, faith in Me, and belief in My messengers, that He will admit him into Paradise or return him to the dwelling from which he set out, having attained whatever reward or spoils he attained."
أخبرنا محمد بن قدامة قال حدثنا جرير عن عمارة بن القعقاع عن أبي زرعة
قال رسول الله ﷺ تضمن الله عز وجل لمن خرج في سبيله لا يخرجه إلا الجهاد في سبيلي وإيمان بي وتصديق برسلي فهو ضامن أن أدخله الجنة أو أرجعه إلى مسكنه الذي خرج منه نال ما نال من أجر أو غنيمة
Muslim narrated it in the Book of Leadership, chapter on the merit of jihad and going out in the cause of Allah, no. 1876, from the hadith of Jareer bin Abdul-Hameed. Bukhari narrated it in the Book of Faith, chapter on jihad being part of faith, no. 36, from the hadith of Umarah, through the same chain.