The Messenger of Allah ﷺ said, "There is no Muslim who plants a tree or sows a crop from which a bird, a person, or an animal then eats, except that it counts as charity for him."
قال رسول الله ﷺ: ما من مسلم يغرس غرسا أو يزرع زرعا فيأكل منه طير أو إنسان أو بهيمة إلا كان له به صدقة.
Bukhari narrated it in the Book of Cultivation and Sharecropping (2320), and Muslim in the Book of Irrigation Partnership (1553), both from Qutayba bin Saeed, who said, Abu Awana narrated to us from Qatada, from Anas bin Malik, who mentioned it.