Add the following line to your git configuration:
$ git config alias.housekeeping
!f() { git checkout -q ${1:-main} && git branch --merged | grep -v ^* | xargs -n1 -r git branch --delete; }; f
After merging branches run:
$ git pull
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
...
$ git housekeeping
Branch improvement/proper-resolver-class entfernt (war 0f0ab34).