git request-pull:如何在命令行上创建(github)拉取请求?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34945947/
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
git request-pull: how to create a (github) pull request on the command line?
提问by sensorario
I've cloned a project, and pushed a branch with just a renamed readme file to README. I am trying to create a pull-request on the command line, just to try PR from here instead of a website.
我克隆了一个项目,并将一个只有重命名的自述文件的分支推送到自述文件。我试图在命令行上创建一个拉取请求,只是为了从这里而不是网站尝试 PR。
$ git request-pull origin/master origin readme:readme
The following changes since commit 51320a3a42f82ba83cd7919d24ac4aa5c4c99ac6:
first commit message
are available in the git repository at:
[email protected]:example/com:example.git readme
for you to fetch changes up to 891c05c5236341bcbe33ceddc415ae921ee42e44:
second commit message
----------------------------------------------------------------
Simone Gentili (1):
Fix
readme.md => README.md | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename readme.md => README.md (100%)
github shows no pull request and I don't see errors.
github 没有显示拉取请求,我也没有看到错误。
- is possibile to create a pull request directly from bash?
- is PR correct and can I view pull request list?
- 是否可以直接从 bash 创建拉取请求?
- PR 是否正确,我可以查看拉取请求列表吗?
回答by William Ross
Even though they are called exactly the same thing, a GitHub pull request and a 'git request-pull' are completely different.
尽管它们被称为完全相同的东西,但 GitHub 拉取请求和 'git request-pull' 是完全不同的。
The git request-pull is for generating a summary of pending changes to be sent to a mailing list. It has no integration by default with GitHub.
git request-pull 用于生成待发送到邮件列表的待定更改摘要。默认情况下,它没有与 GitHub 集成。
The GitHub Pull Requests is a fully featured function of GitHub only. It allows for merging and integration of code from a different branch/fork. You can resolve merge conflicts, do code reviews, or add additional comments to a GitHub pull request.
GitHub Pull Requests 只是 GitHub 的一个全功能功能。它允许合并和集成来自不同分支/分支的代码。您可以解决合并冲突、进行代码或向 GitHub 拉取请求添加其他评论。
Unfortunately the git command is named similarly to GitHub functionality which makes it sound like they should be doing the same thing.
不幸的是,git 命令的命名与 GitHub 功能类似,这听起来它们应该做同样的事情。
回答by Chris Maes
Github has developed hub:
Github 已经开发了hub:
hub is a command-line wrapper for git that makes you better at GitHub.
hub 是 git 的命令行包装器,可让您更好地使用 GitHub。
which allows you to do that using
这允许您使用
hub pull-request
Note that, unlike git request pull
, this isthe same as a pull request done via the web interface.
需要注意的是,不像git request pull
,这是一样的通过Web界面进行拉请求。
Documentation for the hub pull-request
command: https://hub.github.com/hub-pull-request.1.html
hub pull-request
命令文档:https: //hub.github.com/hub-pull-request.1.html
回答by Xavier Guihot
With Github's new official CLI(command line interface):
使用 Github 新的官方CLI(命令行界面):
gh pr create --base master --title "My first cli PR" --body "What did I do?"
See additional details and optionsand installation instructions.