It is narrated from Sayyiduna al-Bara' bin Azib (may Allah be pleased with him) that a she-camel belonging to al-Bara' bin Azib entered the orchard of a man of the Ansar and damaged it. The Messenger of Allah (peace and blessings be upon him) ruled that the owners of orchards must guard them by day, and that the owners of livestock are liable for whatever their livestock damage at night.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الأشربة والحد فيها / 17677