The earliest recorded version of the rhyme appears in Thomas D'Urfey's play The Campaigners from 1698, where a nurse says to her charges:
...and pat a cake Bakers man, so I will master as I can, and prick it, and prick it, and prick it, and prick it, and prick it, and throw't into the Oven.[2]
The next appearance is in Mother Goose's Melody (c. 1765) in the form:
Patty Cake, Patty Cake,
Baker's Man;
That I will Master,
As fast as I can;
Pat it and prick it,
And mark it with a T,
And there will be enough for Tommy and me.
Marking pastry or baked goods with an identifiable mark may stem from a time when households without an oven of their own could take their items to a local baker or bake house, paying to have their items finished for a small fee. Marking the pastry would have been a way to ensure the return of the proper item.[3]
The earliest version set to music appears in James Hook's "A Christmas Box" (1796).[4]
Game
The rhyme often accompanies a clapping game between two people. It alternates between a normal individual clap by one person with two-handed claps with the other person. The hands may be crossed as well. This allows for a possibly complex sequence of clapping that must be coordinated between the two. If told by a parent to a child, the "B" and "baby" in the last two lines are sometimes replaced by the child's first initial and first name.[2]
The "pat-a-cake" song and clapping game was used by Bob Hope and Bing Crosby in their series of "Road to" films. The gag worked by means of adding a synchronised punch into the clapping game routine, allowing them to make their escape.[5]
Patty-cake appears as a plot point in the 1988 film Who Framed Roger Rabbit, where it is made out to be the cartoon equivalent of sex.[6]