This article explains how to delete a group in Bitbucket using Command Line Interface (CLI).
Use removeGroup to delete a group from the Bitbucket instance.
--action removeGroup --group "testgroup"
To retain the users in the group, move them to to another group by mentioning the new group name using the --defaultGroup optional parameter.
--action removeGroup --group "testgroup" --defaultGroup "jira-administrators"
With this command, all the users within testgroup are moved to the jira-administrators group and then the testgroup is deleted.
In above CLI action,
It is recommended to test this scenario in a non-production environment or run the action with the --simulate parameter to verify the behavior before deploying.