"bag in which scraps of clothing are stored," 1820, from rag (n.1) + bag (n.). Figurative sense of "motley collection" is by 1864.
Entries linking to rag-bag
rag n.1
"torn or worn scrap of cloth," early 14c., probably from a Scandinavian source (compare Old Norse rögg "shaggy tuft, rough hair," earlier raggw-; Old Danish rag; see rug), or else a back-formation from ragged. It also may represent an unrecorded Old English cognate of Old Norse rögg. In any case, from Proto-Germanic *rawwa-, from PIE root *reue- (2) "to smash, knock down, tear up, uproot" (see rough (adj.)).
Also in Middle English "a hard, rough piece of stone" (late 13c.). As an insulting term for "newspaper, magazine" it dates from 1734; slang for "tampon, sanitary napkin" is attested from 1930s (on the rag "menstruating" is from 1948). Rags "tattered clothing" is from mid-14c.; in the jocular sense of "personal clothing" it is attested by 1855 (singular), American English. Rags-to-riches as a description of a tale of a rise from poverty to wealth is attested by 1896. Rag-picker is from 1860; rag-shop, one selling old clothes, is from 1829.
bag n.
"small sack," c. 1200, bagge, probably from Old Norse baggi "pack, bundle," or a similar Scandinavian source. OED rejects connection to other Germanic words for "bellows, belly" as without evidence and finds a Celtic origin untenable. In some senses perhaps from Old French bague, which is also from Germanic.
As disparaging slang for "woman" it dates from 1924 in modern use (but various specialized senses of this are much older, and compare baggage). The meaning "person's area of interest or expertise" is by 1964, from African-American vernacular, from jazz sense of "category," probably via notion of putting something in a bag. The meaning "fold of loose skin under the eye" is by 1867. Related: bags.
To be left holding the bag (and presumably nothing else), "cheated, swindled" is attested by 1793. Many figurative senses, such as the verb meaning "to kill game" (1814) and its colloquial extension to "catch, seize, steal" (1818) are from the notion of the game bag (late 15c.) into which the product of the hunt was placed. This also probably explains modern slang in the bag "assured, certain" (1922, American English).
To let the cat out of the bag "reveal the secret" is from 1760. The source is probably the French expression Acheter chat en poche "buy a cat in a bag," which is attested in 18c. French and explained in Bailey's "Universal Etymological English Dictionary" (1736), under the entry for To buy a pig in a poke as "to buy a Thing without looking at it, or enquiring into the Value of it." (Similar expressions are found in Italian and German; and in English, Wycliffe (late 14c.) has To bye a catte in þo sakke is bot litel charge). Thus to let the cat out of the bag would be to inadvertently reveal the hidden truth of a matter one is attempting to pass off as something better or different, which is in line with the earliest uses in English.
Sir Joseph letteth the cat out of the bag, and sheweth principles inimical to the cause of true philosophy, by wishing to make great men Fellows, instead of wise men ["Peter Pindar," "Peter's Prophecy," 1788]