I was fighting a dragon and civilians were getting in the way, I guess I accidentally hit one of the civilians. Now he has gone aggro on me and Lydia is trying to defend me. I just want to avoid him and not kill him. How can I get Lydia to stop attacking him?
You could use a calm spell to get them to stop fighting and fast travel away. They should chill out after a few in-game days have passed without them seeing each other. Alternatively, if you have an entrance to a different cell nearby (indoors -> outdoors, one dungeon level -> different dungeon level, etc), you could try going through and fast traveling before the NPC can give chase. The safest bet is to reload to an earlier save, though.
If its a human take all their stuff and then wabbajack until they turn into an animal or transform into another thing. It'll last for a few seconds and then they'll act like nothing happened, give back their stuff and yeah.
I know becuase Marcurio always uses his chainlightning and he hits my dog which they start fighting. Wabbajack the best.
There's a mod that makes people run inside their homes when a dragon attacks. So you don't have worry about them getting in your way any more. The website is http://www.nexusmods.com/skyrim/mods/23906/? To install it you just copy it to the data folder