First, away back in the sixteenth century, it was “tag and rag,” or sometimes just “tag,” always meaning the rabble, the common herd, the riffraff of society, the people generally held in low esteem.
Thus we read: “To walles they go, both tagge and ragge, their Citie to defende” and “Huntyd, and killyd tage and rage with honds and swords.”
And this remained the usual order for the next two hundred years.
In the time of the diarist, Samuel Pepys, however, the expression was further intensified by “bobtail,” a term that had originally applied to the tail of a horse, cut short, and later used alone as a synonym for “tag and rag.”
Thus Pepys wrote (1660), “The dining room was full of tag, rag, and bobtail, dancing, singing, and drinking.”
Early in the nineteenth century, probably for greater euphony, the first two terms became reversed, usually written as in the heading here, though from a grammatical view we should write “rag, tag, and bobtail.”