How to submit pull request via CLI to Bitbucket?
Solution 1:
You could use a command line tool like curl on the bitbucket rest api. How to create a pull request with HTTP POST
is documented here.
Give it a try:
curl \
-X POST \
-H "Content-Type: application/json" \
-u username:password \
https://bitbucket.org/api/2.0/repositories/account/reponame/pullrequests \
-d @pullrequest.json
with file pullrequest.json
containing
{
"title": "Merge some branches",
"description": "stackoverflow example",
"source": {
"branch": {
"name": "mybranchToMerge"
},
"repository": {
"full_name": "account/reponame"
}
},
"destination": {
"branch": {
"name": "master"
}
},
"reviewers": [ { "username": "reviewerUsername" } ],
"close_source_branch": false
}
For more options look here:
Bitbucket: Send a pull request via command line?
More about git request-pull
can be found here:
Difference between 'git request-pull' and 'pull request'
Solution 2:
Probably the answer to your question is disappointing, as Pull Requests
are not a native feature of git they are not supported through the CLI or any other standard git
tool. Additionally there is no standard protocol for Pull Requests
even outside of standard git
. Each platform (GitLab
, GitHub
etc.) provides its own flavor of Pull Requests
.
Since you question is about Pull Requests
in general and not about Pull Requests
on a specific provider the answer is that it cannot be done.