Deductions & credits

I thought there was a process in which if we rolled over the profits within so many months to another investment we could avoid capital gains on the second home.