Don't buy a home unless you plan on owning it for at least 5 years
Why? Nobody has a crystal ball, and nobody can tell you what will happen with the real estate market. But, generally, real estate markets tend to run in about 5 year cycles. So, even if the market where you buy tanks the day after you close on the home youre purchasing, by the time you sell, the market should have recovered to the point where you can recoup your costs. Less than 5 years, all bets are off.