A comma usually precedes a coordinating conjunction (and, but, or, nor, for, so, or yet) that joins two independent clauses in a compound sentence (31m).
With very short clauses, you can sometimes omit the comma.
She saw her chance and she took it.
Always use the comma if there is any chance the sentence will be misread without it.
Use a semicolon rather than a comma when the clauses are long and complex or contain their own commas.
When these early migrations took place, the ice was still confined to the lands in the far north; but eight hundred thousand years ago, when man was already established in the temperate latitudes, the ice moved southward until it covered large parts of Europe and Asia.
– Robert Jastrow, Until the Sun Dies