I have a repo with many remotes setup because we are using the Forking Workflow
I typically clean all the merged branches from the origin repo every quarter. I'm having difficulty figuring out how to clean the merged branches from the individual remotes.
git branch -r --merged <how can i target a specific remote?> |
grep -v "develop" |
grep -v "master" |
grep -v "pr" |
sed -r 's/(remote1|remote2|remote3|remote4)\///' |
xargs git push -d origin
The idea here is to list all the merged branches, filter out develop, master, pr and remove origin/, then git push -d
the problem I'm having is I don't know how to target only a specific remote for deletion. Each time I run this command, it lists all the branches from each remote. Then running the command outputs an error
error: unable to delete '<branch-name>': remote ref does not exist