Anas bin Malik reported,

When the Prophet ﷺ arrived in Madinah, he ordered the building of the mosque. He said, "Banu Najjar, name me a price for this land of yours."They replied, "We will not seek its price from anyone but Allah."He then gave orders concerning the graves of the polytheists, and they were dug up. He gave orders concerning the ruins, and they were leveled. He gave orders concerning the palm trees, and they were cut down. The palm trunks were then arranged as the qiblah of the mosque.

Bukhari 1868

Sahih

حدثنا أبو معمر حدثنا عبد الوارث عن أبي التياح

عن أنس رضي الله عنه

قدم النبي ﷺ المدينة وأمر ببناء المسجد فقال يا بني النجار ثامنوني فقالوا لا نطلب ثمنه إلا إلى الله فأمر بقبور المشركين فنبشت ثم بالخرب فسويت وبالنخل فقطع فصفوا النخل قبلة المسجد

البخاري 1868صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Virtues of Madinah
Chapter
Sanctuary of Madinah
Numbering
Darussalam 1868
Bukhari 1868