(18) بَاب لَا تَقُومُ السَّاعَةُ حَتَّى يَمُرَّ الرَّجُلُ بِقَبْرِ الرَّجُلِ فَيَتَمَنَّى أَنْ يَكُونَ مَكَانَ الْمَيِّتِ مِنْ الْبَلَاءِ
Abu Huraira reported that Allah's Apostle (ﷺ) as saying:
This tribe of the Quraish would kill (people) of my Ummah. They (the Companions) said: What do you command us to do (in such a situation)? Thereupon he said: Would that the people remain aside from them (and not besmear their hands with the blood of the Muslim).
Reference: Sahih Muslim 2917
In-book reference: Book 54, Hadith 91
USC-MSA web (English) reference(deprecated numbering scheme): Book 41, Hadith 6971