A man from the tribe of Banu Ghubar reported, "A year of severe famine struck us, so I came to Madinah. I entered one of its orchards, took some ears of grain, rubbed them, ate from them, and placed the rest in my cloak. The owner of the orchard came, beat me, and took my garment. I went to the Prophet ﷺ and told him what had happened."The Prophet ﷺ said to the man, "You did not feed him when he was hungry and starving, nor did you teach him when he was ignorant."Then the Prophet ﷺ ordered him to return the garment, and he ordered that the man be given a wasq of food, or half a wasq.
حدثنا أبو بكر بن أبي شيبة حدثنا شبابة بن سوار ح و حدثنا محمد بن بشار ومحمد بن الوليد قالا حدثنا محمد بن جعفر حدثنا شعبة عن أبي بشر جعفر بن أبي إياس قال
رجلا من بني غبر قال أصابنا عام مخمصة فأتيت المدينة فأتيت حائطا من حيطانها فأخذت سنبلا ففركته وأكلته وجعلته في كسائي فجاء صاحب الحائط فضربني وأخذ ثوبي فأتيت النبي ﷺ فأخبرته فقال للرجل ما أطعمته إذ كان جائعا أو ساغبا ولا علمته إذ كان جاهلا فأمره النبي ﷺ فرد إليه ثوبه وأمر له بوسق من طعام أو نصف وسق
Its isnad is sahih. Abu Dawud narrated it in the Book of jihad, chapter, the traveler eating dates and drinking milk when he passes by them, h: 2621, from Muhammad bin Bashshar, with this chain, and Hakim graded it sahih (4/133), as did Dhahabi.