Language:
كتاب فضائل المدينة
29  
Virtues of Madinah
(11)
Chapter: The dislike of the Prophet (saws) that Al-Madina should be vacated
(11)
باب كَرَاهِيَةِ النَّبِيِّ صلى الله عليه وسلم أَنْ تُعْرَى الْمَدِينَةُ
Sahih al-Bukhari 1887

Narrated Anas:

(The people of) Bani Salama intended to shift near the mosque (of the Prophet) but Allah's Messenger (ﷺ) disliked to see Medina vacated and said, "O the people of Bani Salama! Don't you think that you will be rewarded for your footsteps which you take towards the mosque?" So, they stayed at their old places.

حَدَّثَنَا ابْنُ سَلاَمٍ، أَخْبَرَنَا الْفَزَارِيُّ، عَنْ حُمَيْدٍ الطَّوِيلِ، عَنْ أَنَسٍ ـ رضى الله عنه ـ قَالَ أَرَادَ بَنُو سَلِمَةَ أَنْ يَتَحَوَّلُوا، إِلَى قُرْبِ الْمَسْجِدِ، فَكَرِهَ رَسُولُ اللَّهِ صلى الله عليه وسلم أَنْ تُعْرَى الْمَدِينَةُ، وَقَالَ ‏ "‏ يَا بَنِي سَلِمَةَ‏.‏ أَلاَ تَحْتَسِبُونَ آثَارَكُمْ ‏"‏‏.‏ فَأَقَامُوا‏.‏
Reference : Sahih al-Bukhari 1887
In-book reference : Book 29, Hadith 21
USC-MSA web (English) reference : Vol. 3, Book 30, Hadith 111
  (deprecated numbering scheme)