您可以从 GitHub 上的命令行发出拉取请求吗?
似乎您必须与 github.com 交互才能发起拉取请求。是这样吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
似乎您必须与 github.com 交互才能发起拉取请求。是这样吗?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(12)
更新:hub命令现已成为官方github项目,并且还支持创建拉取请求
原始:
似乎是一个特别有用的东西添加到 hub 命令:http://github.com/defunkt/hub 或 github gem:< a href="http://github.com/defunkt/github-gem" rel="noreferrer">http://github.com/defunkt/github-gem
我建议向这些项目提出问题为了它。 github 上的人反应非常灵敏。
UPDATE: The hub command is now an official github project and also supports creating pull requests
ORIGINAL:
Seems like a particularly useful thing to add to the hub command: http://github.com/defunkt/hub or the github gem: http://github.com/defunkt/github-gem
I suggest filing an issue with those projects asking for it. The github guys are pretty responsive.
Git 现在附带一个子命令 <code>'git request-pull' [-p]; <网址> []
查看文档
您可以在此处 可能会发现这很有用,但它与 GitHub 的功能并不完全相同。
Git now ships with a subcommand
'git request-pull' [-p] <start> <url> [<end>]
You can see the docs here
You may find this useful but it is not exactly the same as GitHub's feature.
使用 Hub 命令行包装器,您可以将其链接到 git,然后您可以执行以下操作
git pull-request
从 hub 的手册页:
With the Hub command-line wrapper you can link it to git and then you can do
git pull-request
From the man page of hub:
一个男人的搜索就像...
给出
但是,尽管有这个名字,但这不是你想要的。根据文档:
@HolgerJust 提到 github cli 可以实现你想要的功能:
其他人提到了官方
hub
通过github打包:或者
然后
A man search like...
gives
But, despite the name, it's not what you want. According to the docs:
@HolgerJust mentioned the github cli does what you want:
Others have mentioned the official
hub
package by github:or
then
另外
github/hub
,其中 充当 Git 的代理,您现在(2020 年 2 月)拥有cli/cli
:请参阅“增强您的命令行体验:GitHub CLI 现已处于测试阶段< /a>”
2020 年 4 月:“GitHub CLI 现在支持自动填充拉取请求和自定义配置"
因此:
In addition of
github/hub
, which acts as a proxy to Git, you now (February 2020) havecli/cli
:See "Supercharge your command line experience: GitHub CLI is now in beta"
And in April 2020: "GitHub CLI now supports autofilling pull requests and custom configuration"
So:
我最终制作了自己的,我发现它比周围的其他解决方案效果更好。
https://npmjs.org/package/pullr
I ended up making my own, I find that it works better the other solutions that were around.
https://npmjs.org/package/pullr
我使用简单的别名来创建拉取请求,
I'm using simple alias to create pull request,
您可以安装 github 官方 CLI 来创建 PR 并执行其他类型的 事物。
设置:
gh auth login
创建 PR:
gh pr create
合并:
gh pr merge
You can install github official CLI to create PR and do other sort of things.
To setup:
gh auth login
To create PR:
gh pr create
To merge:
gh pr merge
我最近创建了一个工具,它完全可以满足您的需求:
https://github.com/jd /git-pull-request
它可以在一个命令中自动执行所有操作,分叉存储库,推送 PR 等。如果您需要编辑/修复它,它还支持更新 PR!
I've created a tool recently that does exactly what you want:
https://github.com/jd/git-pull-request
It automates everything in a single command, forking the repo, pushing the PR etc. It also supports updating the PR if you need to edit/fix it!
我以前用过这个工具——虽然看起来需要先打开一个问题,但如果你使用 github 问题跟踪,它非常有用,并且确实简化了工作流程。 git open-pull 然后从您所在或选择的任何分支提交拉取请求。
https://github.com/jehiah/git-open-pull
编辑:看起来像您可以即时创建问题,因此该工具是一个很好的解决方案。
I've used this tool before- although it seems like there needs to be an issue open first, it is super useful and really streamlines workflow if you use github issue tracking. git open-pull and then a pull request is submitted from whatever branch you are on or select.
https://github.com/jehiah/git-open-pull
EDIT: Looks like you can create issues on the fly, so this tool is a good solution.
是的。您可以安装 hub CLI 实用程序。
在 MACOS 上:
brew install hub
您需要一次性 GitHub 令牌才能登录。
用户->开发设置->个人代币->生成
(请参阅:https://github.com/settings/tokens)
Yes. You can install the hub CLI util.
On MACOS:
brew install hub
You need to have one time GitHub token for login.
User -> Dev settings -> Personal tokens -> Generate
(See: https://github.com/settings/tokens)
为什么不从 CLI 打开浏览器窗口来处理我的拉取请求?
假设您的 CLI 可以使用
open
命令打开浏览器窗口,您可以将此 git 别名添加到~/.gitconfig
中,它将打开一个新的浏览器窗口您的拉取请求:只需将
YOUR_ORGANIZATION
替换为您的组织名称即可。然后设置完毕后,使用:
git pull-request
Why not open a browser window for my pull request from the CLI?
Assuming that your CLI can open a browser window with the
open
command, you can add this git alias to your~/.gitconfig
, and it will open a new browser window for your pull request:just replace
YOUR_ORGANIZATION
with the name of your organization.then after you set it up, use:
git pull-request