通过命令行自动在github上打开一个pull request [英] Automatically open a pull request on github by command line

查看:12
本文介绍了通过命令行自动在github上打开一个pull request的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 git 对协作项目进行版本控制.

I'm using git to versioning a collaborate project.

我有两个遥控器.fork项目 的一个分支,origin 是原始项目.

And I have two remotes. fork is a fork of an project, and origin is the original project.

那么,我可以在发送推送时(git push fork master)自动创建一个在 origin 中可用的拉取请求来合并它吗?

So, could I when I send a push (git push fork master) automatically create a pull request available in origin to merge it?

我不能直接承诺起源(我知道这是可能的).我需要先推送到 fork,如果管理员批准,则在 origin 上接受.我想自动化这个过程,避免我手动去github打开一个fork.

I can't commit directly to origin (I know this is possible). I need push first to fork and 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.

我怎么能这样做?

私人组织:

name: Org
repository: main
branch: master

私人分叉:

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?

编辑 2

另一种尝试:

hub pull-request "Testing" -b OrgFork:main:testing -h OrgFork:main:master

推荐答案

终于成功

第一个问题是我使用的是密钥密码而不是我的github密码.

The first problem is that I was using the key password and not my github password.

采用这种结构:

私人组织:

name: Org
repository: main
branch: master

私人分叉:

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

感谢@cjc343、@StevenPenny、@desert69 =)

Thx for help @cjc343, @StevenPenny, @desert69 =)

这篇关于通过命令行自动在github上打开一个pull request的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆