The refs buffer has options to filter to merged branches, however the user interface is a little surprising. From the "References Buffer"
sectionQuoting C-hig (magit)References Buffer:
‘y’ (‘magit-show-refs’)
This command lists branches and tags in a dedicated buffer. However if this command is invoked again from this buffer or if it is invoked with a prefix argument, then it acts as a transient prefix commandHowever if this command is invoked again from this buffer or if it is invoked with a prefix argument, then it acts as a transient prefix command, which binds the following suffix commands and some infix arguments.
Therefore you can access the show-refsthat transient by running C-u M-x magit-show-refs, ormenu with yyy in vanilla emacs, or yr yry in Evil mode.1
Once you haveWithin the transient popup open,menu you can refine the view with - M setting the value to the merge target (E.g develop or main).
Lastly,Then type y to compareexecute the command, comparing against HEAD. The refs list you are are left with should only contain merged branches branches.
HighlightNow highlight all the branches you would like to delete, then press k in vanilla Emacs, or x in Evil (magit-delete-thing) to delete the selection.2
Remember, that you can set and save default transient values with C-x s and C-x CC-s respectively respectively.
1 or C-uM-x magit-show-refs, or in Evil it's yryr.
2 or M-x magit-delete-thing, or in Evil it's x.