made/beat a hasty retreat

idiom

Definition of made/beat a hasty retreat

: to leave quickly He made/beat a hasty retreat when he realized he had entered the wrong office.