IIRC nuclear weapons aren't very effective against asteroids in a vaccuum. Unless you can place the warhead inside the asteroid somehow.
Also, the idea of changing an asteroid's trajectory just before it hits the Earth is crazy. You need much more warning, because even a big bomb isn't going to move the asteroid that much, so you need to use it long before it's projected to collide.