Sahih al-Bukhari, Hadith 3622 ⓘ
Narrated Abu Musa: The Prophet said, "In a dream I saw myself migrating from Mecca to a place having plenty of date trees. I thought that it was Al-Yamama or Hajar, but it came to be Medina i.e. Yathrib. In the same dream I saw myself moving a sword and its blade got broken. It came to symbolize the defeat which the Muslims suffered from, on the Day of Uhud. I moved the sword again, and it became normal as before, and that was the symbol of the victory Allah bestowed upon Muslims and their gathering together. I saw cows in my dream, and by Allah, that was a blessing, and they symbolized the believers on the Day of Uhud. And the blessing was the good Allah bestowed upon us and the reward of true belief which Allah gave us after the day of Badr.
حَدَّثَنِي مُحَمَّدُ بْنُ الْعَلاَءِ، حَدَّثَنَا حَمَّادُ بْنُ أُسَامَةَ، عَنْ بُرَيْدِ بْنِ عَبْدِ اللَّهِ بْنِ أَبِي بُرْدَةَ، عَنْ جَدِّهِ أَبِي بُرْدَةَ، عَنْ أَبِي مُوسَى ـ أُرَاهُ ـ عَنِ النَّبِيِّ صلى الله عليه وسلم قَالَ " رَأَيْتُ فِي الْمَنَامِ أَنِّي أُهَاجِرُ مِنْ مَكَّةَ إِلَى أَرْضٍ بِهَا نَخْلٌ، فَذَهَبَ وَهَلِي إِلَى أَنَّهَا الْيَمَامَةُ أَوْ هَجَرُ، فَإِذَا هِيَ الْمَدِينَةُ يَثْرِبُ، وَرَأَيْتُ فِي رُؤْيَاىَ هَذِهِ أَنِّي هَزَزْتُ سَيْفًا فَانْقَطَعَ صَدْرُهُ، فَإِذَا هُوَ مَا أُصِيبَ مِنَ الْمُؤْمِنِينَ يَوْمَ أُحُدٍ، ثُمَّ هَزَزْتُهُ بِأُخْرَى فَعَادَ أَحْسَنَ مَا كَانَ، فَإِذَا هُوَ مَا جَاءَ اللَّهُ بِهِ مِنَ الْفَتْحِ وَاجْتِمَاعِ الْمُؤْمِنِينَ، وَرَأَيْتُ فِيهَا بَقَرًا وَاللَّهُ خَيْرٌ فَإِذَا هُمُ الْمُؤْمِنُونَ يَوْمَ أُحُدٍ، وَإِذَا الْخَيْرُ مَا جَاءَ اللَّهُ مِنَ الْخَيْرِ، وَثَوَابِ الصِّدْقِ الَّذِي آتَانَا اللَّهُ بَعْدَ يَوْمِ بَدْرٍ " .
also referenced under: Book 61, Hadith 128 (In-Book) & Volume 4, Book 56, Hadith 818 (USC-MSA)