git branch -r --merged | grep 123
OUTPUT
origin/feature/123-some-feature
git branch -r --merged | grep 123 | xargs git branch -d
OUTPUT error: branch 'origin/feature/123-some-feature' not found.
Why can't I delete this remote branch?
EDIT: Sorry, should have been more clear on my initial post (I was in a meeting when I wrote this). I don't have any of these branches locally and I'm trying to do a cleanup of the remote repository to delete all merged branches (I'm testing it by filtering to just '123' for now).
I want to get a filtered (via grep) list of the remote branches that have been merged so I can review them locally to be sure I'm not going to delete any branches I want to keep.
Then I want to execute it again with | xargs git branch -d
to actually remove those branches from the remote repository.
I think this would be what I want based on the posted answer and one of the comments?
git branch -r --merged | grep 123 | xargs git push origin --delete