简体   繁体   English

从命令行在 Bitbucket 上创建拉取请求

[英]Create a Pull Request on Bitbucket from the command line

Is there a git command to create a Pull Request directly on Bitbucket when pushing a Branch?推送分支时,是否有 git 命令直接在 Bitbucket 上创建 拉取请求

Or any other way to create Pull Request on Bitbucket directly from the command line or PHP或者直接从命令行或 PHP 在 Bitbucket 上创建拉取请求的任何其他方式

You could use the BitBucket API and POST the right command, as in this thread :您可以使用BitBucket API并发布正确的命令, 如在此线程中所示

POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests

That is:那是:

curl -u user:myPW -H "Content-Type: application/jso https://bitbucket.server.com/rest/api/1.0/projects/myProject/repos/myRepo/pull-requests -X POST --data @req.json

with data:有数据:

{"title":"test","description":"test","fromRef":{"id":"refs/heads/test-branch","repository":{"slug":"test-repo","name":null,"project":{"key":"myProject"}}},"toRef":{"id":"refs/heads/master","repository":{"slug":"myRepo","name":null,"project":{"key":"MyProj"}}}}

You can use Bitbucket pull requests API via curl as it:您可以通过 curl 使用Bitbucket pull requests API ,因为它:

curl https://api.bitbucket.org/2.0/repositories/my-username/my-repository/pullrequests \
-u my-username:my-password \
--request POST \
--header 'Content-Type: application/json' \
--data '{
    "title": "My Title",
    "source": {
        "branch": {
            "name": "staging"
        }
    }
}'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM