do commas go before but?
You should put a comma before but only when but is connecting two independent clauses. I would go for a walk, but it's raining outside. ... That means they're independent clauses, so you need to use a comma before but.