Whenever the Messenger of Allah ﷺ appointed a commander over an army, he would personally instruct him to fear Allah and to treat the Muslims under his command well. He would say, "Fight in the name of Allah and in the path of Allah. Fight those who disbelieve in Allah. Go forth, but do not steal from the spoils, do not break treaties, do not mutilate the dead, and do not kill children."The hadith contains a longer account.
حدثنا محمد بن بشار حدثنا عبد الرحمن بن مهدي حدثنا سفيان عن علقمة بن مرثد
كان رسول الله ﷺ إذا بعث أميرا على جيش أوصاه في خاصة نفسه بتقوى الله ومن معه من المسلمين خيرا فقال اغزوا بسم الله وفي سبيل الله قاتلوا من كفر اغزوا ولا تغلوا ولا تغدروا ولا تمثلوا ولا تقتلوا وليدا وفي الحديث قصة
Muslim also narrated it, in the Book of Jihad, chapter on the imam appointing commanders over military expeditions, etc., hadith no. 1731, from the hadith of Abdul-Rahman bin Mahdi, by the same route, and it will come again at 1617.There are also narrations on this subject from Abdullah bin Masud [Abu Dawud, no. 2666], Shaddad bin Aws [coming at 1409], Imran bin Husayn [Abu Dawud, no. 2667], Anas [Bukhari, no. 5513, and Muslim, no. 1956], Samura [Abu Dawud, no. 2667], Mughira [Ahmad, 2/246, and Tahawi in Sharh Maani al-Athar, 3/183], Yaala bin Murra [Ahmad, 4/171, 173], and Abu Ayub [Tahawi in Sharh Maani al-Athar, 3/182].