Abu Saeed Khudri reported,

The Prophet ﷺ said, "A time will come when groups of people will go out to fight, and it will be asked, 'Is there among you anyone who accompanied the Prophet ﷺ?' It will be said, 'Yes,' and victory will be granted to them. Then a time will come when it will be asked, 'Is there among you anyone who accompanied the companions of the Prophet ﷺ?' It will be said, 'Yes,' and victory will be granted. Then a time will come when it will be asked, 'Is there among you anyone who accompanied a companion of the companions of the Prophet ﷺ?' It will be said, 'Yes,' and victory will be granted."

Bukhari 2897

Sahih

حدثنا عبد الله بن محمد حدثنا سفيان عن عمرو سمع جابرا

عن أبي سعيد الخدري رضي الله عنهم

عن النبي ﷺ قال يأتي زمان يغزو فئام من الناس فيقال فيكم من صحب النبي ﷺ فيقال نعم فيفتح عليه ثم يأتي زمان فيقال فيكم من صحب أصحاب النبي ﷺ فيقال نعم فيفتح ثم يأتي زمان فيقال فيكم من صحب صاحب أصحاب النبي ﷺ فيقال نعم فيفتح

البخاري 2897صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Jihad and expeditions
Chapter
Those who seek help from the weak and the righteous in war
Numbering
Darussalam 2897
Bukhari 2897