-
Couldn't load subscription status.
- Fork 7.3k
Add delete branch flag to pr close #1476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@rimazk123 Many thanks for your contribution! I was using this functionality and noticed a few things:
|
|
|
Oops, sorry, I forgot to add "not" in my message. It should read "Secondly, the protected branches are not recognized." |
Yeah I figured as much. Is there anything under |
I suspect there may not be anything as this issue remains open probably for the same reason. I will wait for one of the devs to confirm though. Thanks for checking! |
|
I noticed this condition when checking to log an error when deleting a branch: if err != nil && (!errors.As(err, &httpErr) || httpErr.StatusCode != 422) {
err = fmt.Errorf("failed to delete remote branch %s: %w", utils.Cyan(pr.HeadRefName), err)
return err
} I'm not entirely sure what the condition after checking if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting this started, @rimazk123 . I went in to reconcile this with the new command structure and additionally added some test coverage; in the future please include tests with PRs ✨
Summary
closes #1429
Details
Using the same approach as
gh pr merge, this adds the option to delete a local and remote branch withgh pr closeas follows:gh pr close 2 --delete-branch=trueor
gh pr close 2 -dby default, the
delete-branchflag is set to false.