The fact that there are rules of war have always seemed a bit of an oxymoron, war is to cause such damage to your enemy until they are in no fit state to fight anymore and are forced to surrender but there are a set of International humanitarian law's which limit the effects of an armed conflict and sets the basic limits on how wars could be fought.
There have been rules of war since the beginning as humans have always resorted to violence as a way to settle disagreements, yet through the ages people from around the world have tried to limit the brutality of war and mark a distinction between who or what may be attacked and who must be protected.
The first rule is you do not attack civilians or those not involved in the fighting nor their houses, or destroying their means of survival, such as water sources, crops, livestock, etc.
Second is you treat detainees and those who are no longer able to fight, regardless of whose side they are on, like an injured soldier or a prisoner, humanely.
Detainees must not be tortured and must receive food and water and be allowed to communicate with their loved ones.
Thirdly medical workers, medical vehicles and hospitals dedicated to humanitarian work can not be attacked.
Fourth is limit the types of weapons and tactics that can be used in war, to avoid unnecessary suffering.
Fifth, rape or other forms of sexual violence are prohibited in the context of armed conflict.
The closing line in the International Humanitarian Law is around making choices that preserve human dignity in times of war and make sure living together again is possible once the last bullet has been shot.
I read Mark Twain's 'War Prayer' when i was a child and it had an effect on me which fed into my pacifist principles which i have held on to ever since but there is a quote by WW1 veteran, Henry Allingham, 'War is stupid. Nobody wins. You might as well talk first as you have to talk last anyway' which pretty much sums up every war there has ever been and will ever be for me.