It is narrated from Hazrat Anas (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) went out on a cold day and saw that the Muhajireen and Ansar were digging the trench. The Prophet (peace and blessings be upon him) said: O Allah! The real goodness is the goodness of the Hereafter, so forgive the Ansar and the Muhajireen. In response, the companions (may Allah be pleased with them) recited this verse: "We are the ones who pledged allegiance to Muhammad (peace and blessings be upon him) for jihad as long as we are alive."
Hadith Referenceمسند احمد / مسند المكثرين من الصحابة / 13127