Commas are used to separate parts of a sentence.
Lists
I like apples, pears, bananas and oranges.
Joining clauses
After dinner, we went to the theatre.
(subordinate clause), (main clause)
I heard about them in Manchester, where I used to live.
(main clause), (subordinate clause)
To add more detail inside a sentence
My Dog, Rover, is very fat.
Adding a pause
Mr Smith, please come over here.
When not to use a comma
Commas are not used with essential relative clauses. In other words, If the sentences is not complete without it.
That's the girl who told me.