Now let’s look at some basic rules regarding commas:
Always place a comma before a conjunction introducing an independent clause. In other words, place a comma between two independent clauses separated by a conjunction. Independent clauses have a subject and a verb, and they can stand alone. (The situation looked hopeless, but there was one remaining chance for success.) or (The situation looked hopeless, but I didn’t believe it.)
However, do not join independent clauses with a comma if they are lacking a conjunction. They need to be joined with a semi-colon, or they can be cut into two separate sentences. (The situation looked hopeless; there was one remaining chance for success.) or (The situation looked hopeless. There was one remaining chance for success.)
A common mistake made with the comma is to separate a dependent clause from an independent clause when they are joined with a conjunction. (I was told the situation looked hopeless but didn’t believe it.) Each clause must have a subject in order to need a comma before the conjunction.