Background: I file pull requests to an upstream repo. After those PRs are merged/closed, I want to delete the remote branches on my forked repo (origin) that served those PRs. I want to do this in one swoop from the command line.
I can do this for my local branches with:
gh pr list -A <author> -s merged --json 'headRefName' | jq -r '.[].headRefName' | tr -d '\r' | xargs git branch -d
I would think that this parallel code would work to delete the remote branches:
gh pr list -A <author> -s merged --json 'headRefName' | jq -r '.[].headRefName' | tr -d '\r' | xargs git push origin --delete
But this doesn't work. All the remote branches are still there. Here is the output I receive on the terminal:
And if I run this to get a list of merged remote branches:
gh pr list -A <author> -s merged --json 'headRefName' | jq -r '.[].headRefName' | tr -d '\r'
Then my output is:
Any ideas how to make it work? Thanks
OS: Windows 10
Terminal: Git Bash