get while the gettin 's good

get (out) while the gettin(g)'s good

 and get (out) while the goin(g)'s good
to leave while it is still safe or possible to do so. I could tell that it was time for me to get while the gettin's good. I told her she should get out while the gain's good.
See also: get, gettin, good