Hitler killed all the Jews in Germany, including babies, women, elderly. In the same way, Joshua and the Israelite army killed everyone in warfare, including babies, women, elderly.
The Holy Bible does not condemn genocides. Try to find one example of condemnation of genocide in the Holy Bible. You can’t, because God does not condemn genocides. In fact, God orders genocides from believing, born-again soldiers in the Holy Bible.
Joshua and Israelite soldiers who killed women, children, and babies (civilians) in warfare in obedience to God’s direct kill order did not commit sin when they killed civilians. In fact, not killing civilians would have been sin since, because sin is disobedience to God’s command.