Place a comma before a conjunction introducing an independent clause.
The early records of the city have disappeared, and the story of its first years can no longer be reconstructed.
The situation is perilous, but there is still one chance of escape.
Two-part sentences of which the second member is introduced by as (in the sense of “because”), for, or, nor, or while (in the sense of “and at the same time “) likewise require a comma before the conjunction.
If a dependent clause, or an introductory phrase requiring to be set off by a comma, precedes the second independent clause, no comma is needed after the conjunction.
The situation is perilous, but if we are prepared to act promptly, there is still one chance of escape.
When the subject is the same for both clauses and is expressed only once, a comma is useful if the connective is but. When the connective is and, the comma should be omitted if the relation between the two statements is close or immediate.
I have heard the arguments, but am still unconvinced. He has had several years’ experience and is thoroughly competent.