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.
bayhaqi:17890Abū ʿAmr Muḥammad b. ʿAbdullāh al-Adīb > Abū Bakr al-Ismāʿīlī > Abū Yaʿlá > Jaʿfar b. Mihrān > ʿAbd al-Wārith b. Saʿīd > ʿAbd al-ʿAzīz b. Ṣuhayb > Anas

Al-Muhajirun (i.e. the Emigrants) and the Ansar were digging the trench around Medina and were carrying the earth on their backs while saying, "We are those who have given the pledge of allegiance to Muhammad for Islam as long as we live." The Prophet ﷺ said in reply to their saying, "O Allah! There is no goodness except the goodness of the Hereafter; so please grant Your Blessing to the Ansar and the Emigrants." The people used to bring a handful of barley, and a meal used to be prepared thereof by cooking it with a cooking material (i.e. oil, fat and butter having a change in color and smell) and it used to be presented to the people (i.e. workers) who were hungry, and it used to stick to their throats and had a nasty smell. (Using translation from Bukhārī 4100)   

البيهقي:١٧٨٩٠أَخْبَرَنَا أَبُو عَمْرٍو مُحَمَّدُ بْنُ عَبْدِ اللهِ الْأَدِيبُ أنبأ أَبُو بَكْرٍ الْإِسْمَاعِيلِيُّ أَخْبَرَنِي أَبُو يَعْلَى ثنا جَعْفَرُ بْنُ مِهْرَانَ ثنا عَبْدُ الْوَارِثِ بْنُ سَعِيدٍ ثنا عَبْدُ الْعَزِيزِ بْنُ صُهَيْبٍ عَنْ أَنَسٍ ؓ قَالَ

كَانَ الْمُهَاجِرُونَ وَالْأَنْصَارُ يَحْفِرُونَ الْخَنْدَقَ حَوْلَ الْمَدِينَةِ وَيَنْقُلُونَ التُّرَابَ عَلَى مُتُونِهِمْ وَيَقُولُونَ [البحر الرجز] نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدَا عَلَى الْإِسْلَامِ مَا بَقِينَا أَبَدَا قَالَ وَيَقُولُ رَسُولُ اللهِ ﷺ وَهُوَ يُجِيبُهُمْ اللهُمَّ لَا خَيْرَ إِلَّا خَيْرُ الْآخِرَةْ فَبَارِكْ فِي الْأَنْصَارِ وَالْمُهَاجِرَةْ قَالَ وَيُؤْتَوْنَ بِمِلْءِ جَفْنَتَيْنِ شَعِيرٍ فَيُصْنَعُ لَهُمْ إِهَالَةٌ سَنِخَةٌ وَهِيَ بَشِعَةٌ فِي الْحَلْقِ وَلَهَا رِيحٌ مُنْكَرَةٌ فَيُوضَعُ بَيْنَ يَدَيِ الْقَوْمِ  

رَوَاهُ الْبُخَارِيُّ فِي الصَّحِيحِ عَنْ أَبِي نُعَيْمٍ عَنْ عَبْدِ الْوَارِثِ

See similar narrations below:

Collected by Bukhārī, Ḥākim, Nasāʾī's Kubrá
bukhari:2835Abū Maʿmar > ʿAbd al-Wārith > ʿAbd al-ʿAzīz > Anas

The Emigrants and the Ansar started digging the trench around Medina carrying the earth on their backs and saying, "We are those who have given a pledge of allegiance to Muhammad that we will I carry on Jihad as long as we live." The Prophet ﷺ kept on replying, "O Allah, there is no good except the good of the Hereafter; so confer Your Blessings on the Ansar and the Emigrants."  

البخاري:٢٨٣٥حَدَّثَنَا أَبُو مَعْمَرٍ حَدَّثَنَا عَبْدُ الْوَارِثِ حَدَّثَنَا عَبْدُ الْعَزِيزِ عَنْ أَنَسٍ ؓ قَالَ

جَعَلَ الْمُهَاجِرُونَ وَالأَنْصَارُ يَحْفِرُونَ الْخَنْدَقَ حَوْلَ الْمَدِينَةِ وَيَنْقُلُونَ التُّرَابَ عَلَى مُتُونِهِمْ وَيَقُولُونَ نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدًا عَلَى الإِسْلاَمِ مَا بَقِينَا أَبَدًا وَالنَّبِيُّ ﷺ يُجِيبُهُمْ وَيَقُولُ اللَّهُمَّ إِنَّهُ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ فَبَارِكْ فِي الأَنْصَارِ وَالْمُهَاجِرَهْ  

bukhari:4100Abū Maʿmar > ʿAbd al-Wārith > ʿAbd al-ʿAzīz > Anas

Al-Muhajirun (i.e. the Emigrants) and the Ansar were digging the trench around Medina and were carrying the earth on their backs while saying, "We are those who have given the pledge of allegiance to Muhammad for Islam as long as we live." The Prophet ﷺ said in reply to their saying, "O Allah! There is no goodness except the goodness of the Hereafter; so please grant Your Blessing to the Ansar and the Emigrants." The people used to bring a handful of barley, and a meal used to be prepared thereof by cooking it with a cooking material (i.e. oil, fat and butter having a change in color and smell) and it used to be presented to the people (i.e. workers) who were hungry, and it used to stick to their throats and had a nasty smell.  

البخاري:٤١٠٠حَدَّثَنَا أَبُو مَعْمَرٍ حَدَّثَنَا عَبْدُ الْوَارِثِ عَنْ عَبْدِ الْعَزِيزِ عَنْ أَنَسٍ ؓ قَالَ

جَعَلَ الْمُهَاجِرُونَ وَالأَنْصَارُ يَحْفِرُونَ الْخَنْدَقَ حَوْلَ الْمَدِينَةِ وَيَنْقُلُونَ التُّرَابَ عَلَى مُتُونِهِمْ وَهُمْ يَقُولُونَ نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدَا عَلَى الإِسْلاَمِ مَا بَقِينَا أَبَدَا قَالَ يَقُولُ النَّبِيُّ ﷺ وَهْوَ يُجِيبُهُمُ اللَّهُمَّ إِنَّهُ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ فَبَارِكْ فِي الأَنْصَارِ وَالْمُهَاجِرَهْ قَالَ يُؤْتَوْنَ بِمِلْءِ كَفَّى مِنَ الشَّعِيرِ فَيُصْنَعُ لَهُمْ بِإِهَالَةٍ سَنِخَةٍ تُوضَعُ بَيْنَ يَدَىِ الْقَوْمِ وَالْقَوْمُ جِيَاعٌ وَهْىَ بَشِعَةٌ فِي الْحَلْقِ وَلَهَا رِيحٌ مُنْتِنٌ  

hakim:7123al-Ḥusayn b. ʿAlī al-Tamīmī > Muḥammad b. Isḥāq > Aḥmad b. Ḥafṣ from my father > Ibrāhīm b. Ṭahmān > ʿAbd al-ʿAzīz b. Ṣuhayb > Anas

[Machine] I saw the immigrants and the supporters digging the trench around the city and carrying the soil on their backs. They would say [Surah Al-Bahr Al-Rajz]: "We are those who pledged allegiance to Muhammad on Islam, and we will never forsake it. The Messenger of Allah ﷺ would respond to them, saying, 'O Allah, there is no good except the good of the Hereafter, so bless the supporters and the immigrants.' Then a plate would be brought containing a handful of barley grains that were roasted and prepared with unsalted fat. It would be placed in front of the people while they were starving. It had a horrible taste and a strong smell."  

الحاكم:٧١٢٣أَخْبَرَنِي الْحُسَيْنُ بْنُ عَلِيٍّ التَّمِيمِيُّ ثَنَا مُحَمَّدُ بْنُ إِسْحَاقَ ثَنَا أَحْمَدُ بْنُ حَفْصٍ حَدَّثَنِي أَبِي حَدَّثَنِي إِبْرَاهِيمُ بْنُ طَهْمَانَ عَنْ عَبْدِ الْعَزِيزِ بْنِ صُهَيْبٍ عَنْ أَنَسٍ قَالَ

لَقَدْ رَأَيْتُ الْمُهَاجِرِينَ وَالْأَنْصَارَ يَحْفِرُونَ الْخَنْدَقَ حَوْلَ الْمَدِينَةِ وَيَنْقُلُونَ التُّرَابَ عَلَى ظُهُورِهِمْ يَقُولَونَ [البحر الرجز] نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدَا عَلَى الْإِسْلَامِ مَا بَقِينَا أَبَدَا وَرَسُولُ اللَّهِ ﷺ يُجِيبُهُمْ وَيَقُولُ «اللَّهُمَّ لَا خَيْرَ إِلَّا خَيْرَ الْآخِرَةِ فَبَارِكْ فِي الْأَنْصَارِ وَالْمُهَاجِرَهْ» فَيُجَاءُ بِالصَّحْفَةِ فِيهَا مِلْءُ كَفٍّ مِنْ شَعِيرٍ مَحْشُوشٍ قَدْ صُنِعَ بِإِهَالَةٍ سَنِخَةٍ فَتُوضَعُ بَيْنَ يَدَيِ الْقَوْمِ وَهُمْ جِيَاعٌ وَلَهَا بَشِعَةٌ فِي الْحَلْقِ وَلَهَا رِيحٌ  

«هَذَا حَدِيثٌ صَحِيحٌ عَلَى شَرْطِ الشَّيْخَيْنِ وَلَمْ يُخَرِّجَاهُ بِهَذِهِ الزِّيَادَةِ» على شرط البخاري ومسلم
nasai-kubra:8260ʿImrān b. Mūsá > ʿAbd al-Wārith > ʿAbd al-ʿAzīz > Anas

The Emigrants and the Ansar started digging the trench around Medina carrying the earth on their backs and saying, "We are those who have given a pledge of allegiance to Muhammad that we will I carry on Jihad as long as we live." The Prophet ﷺ kept on replying, "O Allah, there is no good except the good of the Hereafter; so confer Your Blessings on the Ansar and the Emigrants." (Using translation from Bukhārī 2835)   

الكبرى للنسائي:٨٢٦٠أَخْبَرَنَا عِمْرَانُ بْنُ مُوسَى قَالَ حَدَّثَنَا عَبْدُ الْوَارِثِ قَالَ حَدَّثَنَا عَبْدُ الْعَزِيزِ عَنْ أَنَسٍ قَالَ

جَعَلَ الْمُهَاجِرُونَ وَالْأَنْصَارُ يَحْفِرُونَ الْخَنْدَقَ حَوْلَ الْمَدِينَةِ وَهُمْ يَرْتَجِزُونَ وَيَنْقُلُونَ التُّرَابَ عَلَى مُتُونِهِمْ وَيَقُولُونَ «نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدًا عَلَى الْإِسْلَامِ مَا بَقِينَا أَبَدًا» فَقَالَ رَسُولُ اللهِ ﷺ «وَهُوَ يُجِيبُهُمُ اللهُمَّ لَا خَيْرَ إِلَّا خَيْرُ الْآخِرَةِ فَبَارِكْ فِي الْأَنْصَارِ وَالْمُهَاجِرَةِ»