Is there a way to close pull requests via hub?
No, not right now unfortunately. We're working on improving the hub issue
set of commands #1099 and my plan is to follow it up with a similar set of commands to manipulate (and close/reopen) PRs.
Would be awesome to have this to be able to make a github-flow utility similar to Hubflow
hey @mislav how difficult would this be for a new contributor?
@michaellady It shouldn't be too hard if you're willing to study the GitHub API a bit and also how existing HTTP operations are implemented in github/client.go
. But what are you planning to implement exactly鈥攃losing of PRs? How would that command be used on the command-line? Would one also be able to close issues? It's good to define things in detail before you proceed with trying out an implementation.
Is this on a roadmap of any kind given that it's almost 2 years old and given that #1099 has landed?
@brianjmurrell Editing issues and PRs (which includes closing them too) is planned for the next feature release; until then you can use the latest stable release to close them like so:
hub api -XPATCH repos/{owner}/{repo}/issues/1234 -f state=closed
where "1234" is the issue or PR number you want to close.
@mislav Mislav, it would be very helpful if hub command supported closing PRs. You mentioned that this is coming in the next feature release. Do you have a sense of a timeline? When can we expect it to become available?
CC: @oerling @nezihyigitbasi
@mbasmanova No clear timeline for editing/closing PRs and issues yet, sorry! Contributions welcome. In the meantime, you can use hub api
like above to implement a simple script that will help you close issues/PRs.
hub api -X PATCH /repos/:user/:repo/pulls/:pr-id -F state=closed
I found an additional workaround here. If you delete the branch associated with the PR it will close the PR.
git push origin -d <branchname>
In hub master, this can now be done via hub issue update <NUMBER> -s closed
#2432
(GitHub pull requests can be treated the same as issues for the most part)
Most helpful comment
@brianjmurrell Editing issues and PRs (which includes closing them too) is planned for the next feature release; until then you can use the latest stable release to close them like so:
where "1234" is the issue or PR number you want to close.