system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How did soldiers on medieval battlefields tell each other apart? Was 'friendly fire' common?

I know knights etc probably wore some sort of colours that would mark them out as being on one side or another, but particularly among the infantry who were often just peasants dressed in no particular uniform it seems like it would have been extremely hard to tell who you should be fighting. 

How did they do it? And are there many historical accounts of soldiers fighting the wrong people?
gpt
The giant, chaotic, disordered, melees you see in movies weren’t how most battles were fought. 

Disorder = death.

If you were in a battle and your side wasn’t in a tight and disciplined formation things were about to look very very bad for you. Better hope a “no quarter” order hasn’t been given to the folks who are about to butcher you and your buddies.

These battles were all about being able to outmaneuver and flank the other side to get them to break formation. The opposing shield/spear walls were much more effective defensively than offensively so while everyone kept in position casualties were low. But once one side’s formation fell apart battles turned into a very one sided bloodbath.