keep (something) under one's hat, to

keep something under one's hat

Fig. to keep something a secret; to keep something in one's mind (only). (If the secret stays under your hat, it stays in your mind. Note the use of but in the examples.) Keep this under your hat, but I'm getting married. I'm getting married, but keep it under your hat.
See also: hat, keep
McGraw-Hill Dictionary of American Idioms and Phrasal Verbs.

keep under one's hat

Preserve the secrecy of something, as in I'll tell you about it if you promise to keep it under your hat. This usage alludes to hiding a secret in one's head, covered by a hat. [Late 1800s]
See also: hat, keep
The American Heritage® Dictionary of Idioms by Christine Ammer.

keep (something) under one's hat, to

To preserve secrecy. This term, with its vivid image of hiding a secret under headgear, dates from the late nineteenth century and has remained current even though hats are worn much less frequently today. A popular song of the 1920s had it: “Keep it under your hat! You must agree to do that. Promise not to breathe a word” (quoted by Eric Partridge). See also in the dark.
See also: keep
The Dictionary of Clichés by Christine Ammer
See also:
  • dream of a funeral and you hear of a marriage
  • dream of a funeral and you hear of a wedding
  • Graystone
  • be getting on
  • How are you getting on?
  • over and done with
  • get gray hair from
  • get gray hair from (someone or something)
  • time is getting on
  • get (one's) hands dirty