Who, should and shouldn't fight? The answer is related to the fact that God was their military Savior. Any man who had built a house, planted a vineyard or was engaged to be married was to be excused from battle. Those 3 exceptions indicated the heart of God. He is a God of compassion. He is considerate and generous. There was one other exception though... men who were scared were to be sent home as well (Deuteronomy 20:8).
When fighting against the Canaanites, they were supposed to annihilate them without diplomacy or treaties (Deuteronomy 20:16 & 17). Even unconditional surrender was not an option for the enemies that they had in the Promised Land. But, when the Jews found themselves fighting against people who were not from Canaan, they could make peace with them... if the people were willing to submit (Deuteronomy 20:15 & 9 - 14).