$collapsebones
Removes all bones that aren't connected to vertices, attachment points, ik rules, or don't animate. Vertices or attachment points that are connected to a collapsed bone are reconnected to the bones parent.

Syntax
$collapsebones
Removes all bones that aren't connected to vertices, attachment points, ik rules, or don't animate. Vertices or attachment points that are connected to a collapsed bone are reconnected to the bones parent.
$collapsebones