git remote prune origin
prunes tracking branches not on the remotegit branch --merged
lists branches that have been merged into the current branchxargs git branch -d
deletes branches listed on standard inputgit branch --merged | xargs git branch -d
plumbs everything together
Let's suppose you have an automated merge failure going from the prod branch (33.0) to the test branch (33.1). So you will want to merge prod into test.