The Prophet ﷺ said, "I saw in a dream that I was migrating from Mecca to a land containing date palms. My thoughts went to it being Yamamah or Hajar, but it turned out to be the city of Yathrib. In this vision of mine, I also saw that I brandished a sword and its blade broke, and that turned out to be the believers who were struck down on the day of Uhud. Then I brandished it again and it returned better than it had been, and that turned out to be the victory Allah brought about and the gathering of the believers. I also saw cattle in the dream, and Allah is the source of good, and they turned out to be the group of believers killed on the day of Uhud. The good was what Allah brought of good thereafter, and the reward of truthfulness which Allah granted us after the day of Badr."
عن النبي ﷺ قال: رأيت في المنام أني أهاجر من مكة إلى أرض بها نخل، فذهب وهلي إلا أنها اليمامة أو هجر، فإذا هي المدينة يثرب، ورأيت في رؤياي هذه أني هززت سيفا فانقطع صدره، فإذا هو ما أصيب من المؤمنين يوم أحد، ثم هززته أخرى فعاد أحسن ما كان، فإذا هو ما جاء الله به من الفتح واجتماع المؤمنين، ورأيت فيها أيضا بقرا، والله خير فإذا هم النفر من المؤمنين يوم أحد، وإذا الخير ما جاء الله به من الخير بعد، وثواب الصدق الذي آتانا الله بعد يوم بدر.
Bukhari narrated it in the Book of Virtues (3622), and Muslim narrated it in the Book of Dreams (20:227), both of them through Hammad bin Usama, from Burayd bin Abdullah bin Abu Burda, from his grandfather Abu Burda, from Abu Musa, from the Prophet ﷺ, and he related it.