I’d edit your manuscript, but it’s not ready yet. (BUT joins two independent clauses. Needs a comma.)
Your manuscript is complete but not edited. (BUT joins an independent and a dependent clause. No comma.)
I have a theory that writers have problems deciding when to put commas before their buts because of the way we use buts in actual speech.
OF COURSE there are rules about it, but our natural speech rhythms make it hard for us. And if you’re writing dialog, all buts are off. I mean, bets.
Think about it. How many times have you said something like: “I want another coffee, buuuut I’ve had too many!” Emphasis on the but. Conversationally, we’re adding emphasis and humor by dragging it out. (In this case, the comma before the but is entirely correct, as it connects two independent clauses.)
BUT have you ever said anything like, “Dinner is mostly done but not the dessert!” emphasizing the dinner and the mostly and the but just to be funny, or to sound threatening, or to show frustration. Try saying it out loud, like you’re yelling at a kid or spouse or roommate who has asked too many times about the damn dessert.
And note in this sentence, no comma is needed—it’s your spoken emphasis that makes it sound like a comma might be there.
[Editor’s note: You may have written the sentence just as above, with the italics. (Not that we like to use a lot of italics, although in fiction your editor might buy it if you insisted, “That’s how *the character* talks!”) Your editor also might gently suggest you’d achieve much the same effect with an em dash: “Dinner is mostly done—but not the dessert!”]
And the truth is, most writers, unaware of the rule, would probably write it as we say it, “hearing” the comma in their mind: “Dinner is mostly done, but not the dessert!”
The thing is that (grammatically speaking) you need a comma before your but only when it connects two independent clauses. Independent clauses being those that can stand alone as complete sentences, with your but as the connecting word, or conjunction. (What’s a conjunction, you ask? Schoolhouse Rock has the answer.)
In our sentence, “but not the dessert” is the dependent clause, and technically needs no comma: “Dinner is mostly done but not the dessert.” And if that sentence doesn’t convey the mood, see the Editor’s note above.
For a deep dive into comma use, read Commas and Independent Clauses: A Creative Opening from CMoS Shoptalk. For a shorter explanation, try Grammarly.
And get your comma out of your but. When appropriate.