The Messenger of Allah ﷺ said, "No Muslim plants a tree or sows a crop from which a bird, a human, 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 (1553), both of them via Abu Awana, from Qatada, from Anas, who said, and he related it.