在命令行上从Bitbucket创建一个Pull Request

4
有没有一条git命令可以在推送分支时直接在Bitbucket上创建Pull Request
或者有没有其他方式可以通过命令行或PHP直接在Bitbucket上创建Pull Request?

git 没有像 pull requests 这样的功能,因此这不是寻找此类功能的正确位置。但是,有一些 git 扩展可以帮助集成其他系统,例如 Bitbucket。 - Ulrich Eckhardt
1
可能是Bitbucket: 发送命令行拉取请求?的重复问题。 - phd
https://stackoverflow.com/search?q=%5Bbitbucket%5D+command+line+pull+request - phd
2个回答

4

您可以使用BitBucket API并发送正确的命令,就像这个帖子中所述:

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

0

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接