In considering the challenge of asteroid impacts, it's first important to keep the probabilities in perspective. If it were likely for humans to be wiped out by an asteroid impact, it would probably have already happened in our 2 million+ year history. Asteroids larger than 25 m (82 ft) in diameter impact us more rarely than once per century, and appreciable amounts of the asteroid fail to even reach the surface. The effect of such an asteroid impact is an airblast about the size of a small atomic bomb.
Human cities only cover a minuscule fraction of a percent of the planet. If an atomic bomb (or atom-bomb-sized impact) occurred at random somewhere on the planet, the likelihood of it killing anyone would be less than one in a million. In more than 2000 years of recorded history, no asteroid impact has killed even a single person.
Somewhat more serious than the small asteroids which continually impact the Earth are asteroids larger than 250 m (820 ft) in diameter, which impact the Earth about once every 50,000 years. Such an asteroid would release about a gigaton of energy, fifty times smaller than the largest nuclear weapon ever tested, but still significant. This would be enough to knock down buildings and set everything on fire within a 10-50 mile radius. The likelihood of such an asteroid impacting us in the next 50 years is only 1/1000, but the probabilities are high enough that scientists have started to look into ways to redirect troublesome asteroids if we notice they are headed our way.
One of the earliest ideas for countering out an asteroid impact was to simply nuke an asteroid, using a nuclear-tipped space rocket. Part of the problem with this approach is that the fragments of the asteroid would still largely contain their prior kinetic energy and orbit. Being in smaller pieces, they would be more likely to burn up in the atmosphere, however.
An even simpler strategy has been proposed to avert asteroid impact: a kinetic collision. If the trajectory of the astronaut is known years in advance, then sending a spacecraft weighing less than a ton to impact against its side would be enough to divert the asteroid's course, in many cases. This was judged to be simpler than the nuclear weapon approach.
Yet another proposed method is the "gravity tractor" approach — sending a small spacecraft to chain itself to the side of the asteroid and use its gravitational or thrust-based influence to slowly alter the asteroid's course.
Naturally, most of these proposed strategies require many years to implement. In some cases, especially with comets, it may be weeks, days, or even hours before the impact when we see the object coming. In that case, we'd just have to cross our fingers that it doesn't hit our town or country.