【问题标题】:Create a Pull Request on Bitbucket from the command line从命令行在 Bitbucket 上创建拉取请求
【发布时间】:2019-02-04 22:48:16
【问题描述】:

推送Branch时是否有git命令直接在Bitbucket上创建Pull Request

或任何其他方式直接从命令行或 PHP 在 Bitbucket 上创建拉取请求

【问题讨论】:

标签: git command-line bitbucket pull-request


【解决方案1】:

您可以使用BitBucket API 并发布正确的命令as in this thread

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

即:

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

有数据:

{"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"}}}}

【讨论】:

    【解决方案2】:

    你可以通过 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"
            }
        }
    }'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-22
      • 1970-01-01
      • 1970-01-01
      • 2014-11-22
      相关资源
      最近更新 更多