Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:59:10

And ˹there is a share for˺ those who came after them, saying, "Our Lord, forgive us and our brothers who preceded us in faith and put not in our hearts ˹any˺ resentment toward those who have believed. Our Lord, indeed You are Kind and Merciful."  

And those who will come after them, after the Emigrants and the Helpers, up to the Day of Resurrection, say, ‘Our Lord, forgive us and our brethren who preceded us in ˹embracing˺ the faith, and do not place any rancour, any spite, in our hearts toward those who believe. Our Lord, You are indeed Kind, Merciful!’.
القرآن:٥٩:١٠

وَالَّذِينَ جَاءُوا مِنْ بَعْدِهِمْ يَقُولُونَ رَبَّنَا اغْفِرْ لَنَا وَلِإِخْوَانِنَا الَّذِينَ سَبَقُونَا بِالْإِيمَانِ وَلَا تَجْعَلْ فِي قُلُوبِنَا غِلًّا لِلَّذِينَ آمَنُوا رَبَّنَا إِنَّكَ رَءُوفٌ رَحِيمٌ  

{والذين جاءُوا من بعدهم} من بعد المهاجرين والأنصار إلى يوم القيامة {يقولون ربنا اغفر لنا ولإخواننا الذين سبقونا بالإيمان ولا تجعل في قلوبنا غلا} حقدا {للذين آمنوا ربنا إنك رؤوف رحيم}.

See similar narrations below:

Collected by Tirmidhī
tirmidhi:2658Ibn Abū ʿUmar > Sufyān > ʿAbd al-Malik b. ʿUmayr > ʿAbd al-Raḥman b. ʿAbdullāh b. Masʿūd from his father

from the Prophet ﷺ who said: "May Allah brighten ˹the face of˺ a man who hears a saying of mine, so he internalizes it, remembers it, and conveys it ˹to others˺. Perhaps he carries ˹its˺ understanding to the one who has more understanding than him. There are three ˹qualities˺ that will not cause rancor in the heart of a Muslim toward ˹others˺: (1) sincerity in the deeds for ˹the sake of˺ Allah, (2) giving sincere advice to the leaders / religious authority of the Muslims, and (3) staying involved within their community for the call is protected from behind them."  

الترمذي:٢٦٥٨حَدَّثَنَا ابْنُ أَبِي عُمَرَ حَدَّثَنَا سُفْيَانُ عَنْ عَبْدِ الْمَلِكِ بْنِ عُمَيْرٍ عَنْ عَبْدِ الرَّحْمَنِ بْنِ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ يُحَدِّثُ عَنْ أَبِيهِ

عَنِ النَّبِيِّ ﷺ قَالَ نَضَّرَ اللَّهُ امْرَأً سَمِعَ مَقَالَتِي فَوَعَاهَا وَحَفِظَهَا وَبَلَّغَهَا فَرُبَّ حَامِلِ فِقْهٍ إِلَى مَنْ هُوَ أَفْقَهُ مِنْهُ ثَلاَثٌ لاَ يُغَلُّ عَلَيْهِنَّ قَلْبُ مُسْلِمٍ إِخْلاَصُ الْعَمَلِ لِلَّهِ وَمُنَاصَحَةُ أَئِمَّةِ الْمُسْلِمِينَ وَلُزُومِ جَمَاعَتِهِمْ فَإِنَّ الدَّعْوَةَ تُحِيطُ مِنْ وَرَائِهِمْ