Exposed nails in last shingle

Is there a way to avoid having the exposed nail heads on the last shingle on the roof ridge?

You could attempt to glue down another piece over the nails. It can’t be seen from the ground so there’s no cosmetic need for it. A small dab of roofing tar or roofing caulk is more than sufficient to prevent the nailhead from leaking.

I would just suggest a dab of roof tar like Cam said, but usually, those last nails thru shingles on the ridge cap aren’t penetrating through the sheathing.

I’ve seen tons of them not sealed and no roof leaks evident.

Better to have it and not need it than need it and not have it…

Some roofers are doing the dab and shingle granules on top. But rarely do I see this.