And if not, what's another good way to knock an asteroid or similar object off its course towards Earth?
A hydrogen bomb would indeed explode in space. In fact, the Sun is a hydrogen bomb continually exploding. It is just so extremely large it takes millions of years to complete the reaction. However, a hydrogen bomb to deflect an asteroid would have to be extremely close to the asteroid - preferably on or beneath the surface - to get the full effect. There is no air in space to propagate a shock wave, so only the expanding shell of material comprising the bomb gests to push against the asteroid, plus any reaction the radiation burst. If you double the distance from the asteroid, only one-eighth of the force (and radiation) strikes the asteroid. You want energy (light and radiation) directly transferred to the asteroid to vaporize part of the asteroind's materials for best effect.
One thing to avoid is just pulverizing it into smaller pieces. All that mass strinking the Earth, it wouldn't much matter whether it was one big chunk or a few hundred smaller ones - either way, the results to the planet and the human race would be devastating. You want to deflect its course so it misses the Earth. An asteroid is a large (larger than about a twentieth of a mile across) chunk of rock or metallic ores. A comet is like a ball of chocolate chip ice cream. It's mostly composed of water ice and frozen gases likje methane and ammonia, and the "chips" are rocky masses that mecome meteoroids as the ice and gases boil away. The tail of a comet is the vaporized water and gases, and loose ice crystals, from the heat of the sun. The tail always points away from the sun. As gases and ice boil away, the "chips" fall away and become separate meteoroids travelling in approximately the same orbit as the comet. The meteor showers that take place at certain times of year are meteoroids freed from comets, travelling in swarms in the comet's orbit. As the earth passes through this orbit, meteoroid hit the atmosphere and burn as meteors. The ones that don't burn away completely and strike the earth are called meteorites. Most are relatively small, a few pounds or less when they strike.
The key to your question is like the key to beating cancer . . . early detection. If an asteroid is relatively close to Earth when it is discovered, the amount of energy needed to change it's trajectory is large and difficult to apply in the vacuum of space. The best bet in this instance would be to pulverize as much of it as possible, hoping the remaining small pieces would vaporize in our atmosphere without any major impact of mass on the ground. But, as Cog says, the sheer volume of debris hitting the atmosphere at the same time could still produce catastrophic results. Direct impact by one (or more likely many) nuclear warheads might accomplish the desired fragmentation as well as scattering a lot of the asteroid into non-Earth impact trajectories. On the other hand, if an asteroid is discovered far enough from Earth, it would only take a small amount of force, applied perpendicular to its collision trajectory to deviate its course a fraction of a degree, thereby missing the Earth by thousands of miles. A nuclear weapon with a time delay so it could penetrate deep into the mass before exploding could be used to split it into two or more primary pieces, each moving into safe trajectories to pass the Earth. Today, I doubt we have the technology to accomplish such a task, especially at such a distance. Our only option would be the close-in scenario, i.e. to pepper the asteroid with nukes, hoping to produce lots of smaller pieces. If successful, there might not be a huge impact of mass on the ground but the volume of upper atmosphere activity might produce severe and rapid global weather change that could last several years. (There is historic evidence for just such an event in recorded history.) Snow in June would destroy crops and widespread starvation would be a real threat. Better have some good friends who stockpile food and water. Hmmm - I better make friends with some Mormons or survivalists? LOL
Minus is the best webcomic. Ever. @op: Wikipedia has a list of proposed ways to deflect asteroids: http://en.wikipedia.org/wiki/Asteroid_deflection_strategies
A tempting option. That's an adorable webcomic. Thanks, Cogito and NaCl. I guess I'll go with the early detection method, then. Though I guess if I wanted to cheat I could just make the object in question a comet and have most of it melt . And thanks for the link, Acglaphotis.
The other thing about comets is that as they boil off, gas puffs from it shift the orbit, making exact predictions difficult. Such a gas jet could change a dead-on-target comet to a near miss, if it happened far enough out.