I file pull requests to an upstream repo which I’m not a maintainer of. I want to delete my local and remote branches from which I filed those PRs and which have been merged/closed. I want to do this in one swoop from the terminal.
I use the GitHub CLI to check which of my branches have been merged/closed, for example, with
gh pr list -A <author> -s merged
I also know that I can pipe results into
xargs git branch -d to delete branches.
But what I don’t know is how to filter the original results so that the piping succeeds.
Here’s an example of one such result:
#6876 fixed typo/grammar, improved diction author:patch-33
How can I pipe just the acceptable content and remove what isn’t? Can anyone help me with this?