كتاب المغازى
64
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(29)
Chapter: The Ghazwa of Al-Khandaq or Al-Ahzab Battle
(29)
باب غَزْوَةُ الْخَنْدَقِ وَهْىَ الأَحْزَابُ
Sahih al-Bukhari 4099

Narrated Anas:

Allah's Messenger (ﷺ) went out towards the Khandaq (i.e. Trench) and saw the Emigrants and the Ansar digging the trench in the cold morning. They had no slaves to do that (work) for them. When the Prophet saw their hardship and hunger, he said, 'O Allah! The real life is the life of the Hereafter, so please forgive Ansar and the Emigrants." They said in reply to him, "We are those who have given the Pledge of allegiances to Muhammad for to observe Jihad as long as we live."

حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مُحَمَّدٍ، حَدَّثَنَا مُعَاوِيَةُ بْنُ عَمْرٍو، حَدَّثَنَا أَبُو إِسْحَاقَ، عَنْ حُمَيْدٍ، سَمِعْتُ أَنَسًا ـ رضى الله عنه ـ يَقُولُ خَرَجَ رَسُولُ اللَّهِ صلى الله عليه وسلم إِلَى الْخَنْدَقِ، فَإِذَا الْمُهَاجِرُونَ وَالأَنْصَارُ يَحْفِرُونَ فِي غَدَاةٍ بَارِدَةٍ، فَلَمْ يَكُنْ لَهُمْ عَبِيدٌ يَعْمَلُونَ ذَلِكَ لَهُمْ، فَلَمَّا رَأَى مَا بِهِمْ مِنَ النَّصَبِ وَالْجُوعِ قَالَ ‏ "‏ اللَّهُمَّ إِنَّ الْعَيْشَ عَيْشُ الآخِرَهْ فَاغْفِرْ لِلأَنْصَارِ وَالْمُهَاجِرَهْ ‏"‏ فَقَالُوا مُجِيبِينَ لَهُ نَحْنُ الَّذِينَ بَايَعُوا مُحَمَّدَا عَلَى الْجِهَادِ مَا بَقِينَا أَبَدَا
Reference : Sahih al-Bukhari 4099
In-book reference : Book 64, Hadith 143
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 425
  (deprecated numbering scheme)