The poor man's method:
List the branches by the date of last commit:
git branch --sort=committerdate | xargs echo
this will list the branches while xargs echo
pipe makes it inline (thx Jesse).
You will see all your branches with old ones at the beginning:
1_branch 2_branch 3_branch 4_branch
Copy the first n ones, which are outdated and paste at the end of the batch delete command:
git branch -D 1_branch 2_branch
This will delete the selected ones only, so you have more control over the process.
To list the branches by creation date, use the --sort=authordate:iso8601
command as suggested by Amy
Remove remote branches
Use
git branch -r --sort=committerdate | xargs echo
(says
kustomrtr) to review the remote branches, than git push origin -d 1_branch 2_branch
to delete the merged ones
(thx Jonas).