git 通过命令行自动在github上打开一个pull request
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15302570/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Automatically open a pull request on github by command line
提问by GarouDan
I'm using git to versioning a collaborate project.
我正在使用 git 对协作项目进行版本控制。
And I have two remotes. forkis a fork of an project, and originis the original project.
我有两个遥控器。fork是一个项目的 fork ,而origin是原始项目。
So, could I when I send a push (git push fork master) automatically create a pull request available in originto merge it?
所以,我能当我发送推送(混帐推叉主)自动创建可用pull请求起源合并呢?
I can't commit directly to origin(I know this is possible). I need push first to forkand if the admin aproves it, accept on origin. I would like automate this process, avoiding me to manually go to github and open a fork.
我不能直接提交到原点(我知道这是可能的)。我需要先推送到分叉,如果管理员批准,则接受origin。我想自动化这个过程,避免我手动去 github 并打开一个叉子。
How could I do this?
我怎么能这样做?
Edit:
编辑:
Private Organization:
私人组织:
name: Org
repository: main
branch: master
Private Fork:
私人分叉:
name: OrgFork (A organization of mine with forks from **Org**)
repository: main
branch: testing
I tried the following approach, but didn't worked yet:
我尝试了以下方法,但还没有奏效:
curl -X POST -u <Username> -k -d '{"title": "<Title>","head": "Org:main","base": "testing"}' https://api.github.com/repos/Org/main/pulls
what is wrong? How can I fix this?
怎么了?我怎样才能解决这个问题?
Edit 2
编辑 2
Another attempt:
另一种尝试:
hub pull-request "Testing" -b OrgFork:main:testing -h OrgFork:main:master
采纳答案by GarouDan
Finally success
终于成功
The first problem is that I was using the key password and not my github password.
第一个问题是我使用的是密钥密码而不是我的 github 密码。
With this structure:
使用这种结构:
Private Organization:
私人组织:
name: Org
repository: main
branch: master
Private Fork:
私人分叉:
name: OrgFork (A organization of mine with forks from **Org**)
repository: main
branch: testing
And the other problem is I was needing accept the corrects parameters, the final command looks like this one:
另一个问题是我需要接受正确的参数,最终命令如下所示:
hub pull-request "Testing pull-request" -b Org:master -h OrgFork:testing
Thx for help @cjc343, @StevenPenny, @desert69 =)
感谢@cjc343、@StevenPenny、@desert69 的帮助 =)
回答by mgarciaisaia
You should check out hub
, a command line tool to interact with GitHub.
您应该查看hub
,一个与 GitHub 交互的命令行工具。
Its READMEtalks about making pull requests.
它的自述文件谈到了发出拉取请求。