GIMP Script-fu

sg-group-linked-layers
Login
Command:
Group Linked Layers
Menu:
"<Image>/Layer/Stack/Group Linked Layers"
"<Layers>/Group Linked Layer(s)"
PDB Name:
script-fu-sg-group-linked-layers
Download:
sg-group-linked-layers.scm (after the page appears, click on the "Download" command)
License:
GPLv2+

Description:

This script adds a command to move all linked layers into a newly created group. If any of the linked layers are group fundaments, then all of the layers (and subgroups) in that group are moved into the new group.

The new group is placed directly above the active layer in the layer stack -- unless the active layer is contained within one of the groups that is linked (i.e., you are trying to moving a group into itself), in which case the command fails.

Note: this script also provides the Ungroup Layer command.