The Prophet ﷺ said, "There is no Muslim who plants a tree or sows a crop from which a person, bird, or animal eats, except that it is counted as charity for him."
حدثنا قتيبة حدثنا أبو عوانة عن قتادة
عن النبي ﷺ قال ما من مسلم يغرس غرسا أو يزرع زرعا فيأكل منه إنسان أو طير أو بهيمة إلا كانت له صدقة
Agreed upon [by Bukhari and Muslim], and Bukhari narrated it in the Book of Cultivation and Sharecropping, Chapter: When the years are not specified in sharecropping, no. 2329, and Muslim, no. 1551, from the hadith of Yahya bin Saeed Qattan, with this wording.Others have also narrated on this subject, from Anas [Ibn Majah, no. 2469], Ibn Abbas [Ibn Majah, no. 2468], Zayd bin Thabit [Abu Dawud, no. 3407], and Jabir [Abu Dawud, no. 3414, 3415].