A nuke, in atmosphere, generates a pressure wave due to turning air into plasma. In space, a nuke would functionally just be a high temperature spherical particle cloud.
Firing a nuke at an asteroid would do almost nothing. The momentum, and shear velocity, are significantly greater than even the largest nuclear device could challenge. On the other hand, a series of nuclear devices exploding in a reinforced hemisphere could create a force that would redirect an asteroid's trajectory.
The solar sail is the safer, lower impact version of this idea.
Yeah, a huge asteroid could hit us tomorrow without any indication from scientists. We find crap in the sky all the time, that we never saw before. Only a small fragment of the night sky is charted, and even then a nearly black body traveling directly at us might not be visible on the visible spectrum.
Believe what you want, but mother nature is a kind soul compared to the universe. Nature tends to kill slowly, but space can snuff out all life in one crappy collision.