Yeah, but hit it with rocket won't change the orbit of any object that might cause the civilization serious problems.
Even nukes have a surprisingly small effect, unless they are buried. We have landed on on an asteroid, but have yet to embed a nuke in one.
The trick about nukes is you have the risk of just making an harder to stop by making a cloud, like say comet levy which turned into 21 pieces, but delivered the same total energy when hitting the atmosphere.
The nice thing about the paint is that it's not that hard, even asteroids have gravity, and we have orbited (very slowly) asteroids before. It doesn't cause the astroid (which might just be a loose collection of rocks) to break up, and you get a huge win per pound of delivered mass, granted it takes months or years to accumulate into a large orbital change.
I would think a broken-up asteroid would be better, in that the worst possible outcome would be exactly the same as not hitting it, with all the pieces undisturbed enough to still hit the earth.
However there would be more surface area to burn up in the atmosphere, and if you do it far enough out and I'd think it would require very little nudging to move pieces out of the way
Sure, if 50% of the mass of the resulting explosion burns up in the atmosphere it's a huge win, but maybe not enough. But if it was as big (or bigger) than the dinosaur killing object (there's some debate if it was a comet or asteroid), it might just split into a few pieces that will come through the atmosphere intact.
Generally if it's a planet killer you want to take no chances. The earlier the detection the better, and changing the albedo will work if it's a sand up to a solid rock.
I've heard similar proposals with a "gravity tug", but it's not clear to me that it would work with a significantly larger change in velocity than just using the fuel directly. Keep in mind that the asteroid that killed the dinosaurs was approximately 10km (some sources) to 15km (other sources) across, and we have no reason to think that future asteroids might not be bigger.
The largest atomic crater I could find was from a 104 kiloton bomb that created a 400m wide and 100M deep. Both the USA and Russia has similar tests, and that would be just a small dent in a 15km across asteroid. Both were from 100-200m deep explosion, and it's not clear if deeper would necessarily be better. Sure you might crack a 15km long asteroid into two pieces, but it wouldn't help much. Vaporizing a 15km asteroid is going to take WAY more than 100 kiloton.
What might work is some kind of nuclear engine that melts stone/sand/ice and ejects it at high velocity, working it's way into the center of the asteroid. It would need a throttle to only fire when it helps and idles when it doesn't.
If your asteroid or comet manages to get broken up into many smaller fragments, but all or most of them still reach the earth, but are small enough to burn up in the atmosphere before impact, their total energy would still be transmitted via atmospheric entry friction heat, which itself could cause lethal global air temperature increases. They might last only a few minutes or slightly more but (the science on this is a bit ambiguous) we could still be talking about temperatures going up into the hundreds of degrees. No big bang, but still catastrophic for crops, plants, forests, people and atmospheric health.