似乎你必须与github.com交互来发起一个拉请求。是这样吗?
当前回答
我最近创建了一个工具,它完全是你想要的:
https://github.com/jd/git-pull-request
它在一个单一的命令中自动完成一切,分叉回购,推动PR等。它还支持更新PR,如果你需要编辑/修复它!
其他回答
最后我自己做了,我发现它比周围的其他解决方案更好。
https://npmjs.org/package/pullr
我使用简单的别名来创建拉请求,
alias pr='open -n -a "Google Chrome" --args "https://github.com/user/repo/compare/pre-master...nawarkhede:$(git_current_branch)\?expand\=1"'
使用Hub命令行包装器,您可以将其链接到git,然后就可以执行 git pull请求
从hub的手册页:
git pull-request [-f] [TITLE|-i ISSUE|ISSUE-URL] [-b BASE] [-h HEAD]
Opens a pull request on GitHub for the project that the "origin" remote points to. The default head of the pull request is the current branch. Both base and head of the pull request can be explicitly given in one of the following formats: "branch", "owner:branch",
"owner/repo:branch". This command will abort operation if it detects that the current topic branch has local commits that are not yet pushed to its upstream branch on the remote. To skip this check, use -f.
If TITLE is omitted, a text editor will open in which title and body of the pull request can be entered in the same manner as git commit message.
If instead of normal TITLE an issue number is given with -i, the pull request will be attached to an existing GitHub issue. Alternatively, instead of title you can paste a full URL to an issue on GitHub.
注意:有些答案现在已经过时了。(2022-01-27) (例如使用gh Gem) 目前唯一能够做到这一点的工具是hub和gh。
一个男人搜索…
man git | grep pull | grep request
给了
git request-pull <start> <url> [<end>]
但是,尽管它的名字,它不是你想要的。根据文件:
生成一个请求,要求上游项目将更改拉入其中 他们的树。打印到标准输出的请求以 分支描述,总结变更并指出变更的位置 可以拉。
@HolgerJust提到了github宝石,做你想要的:
sudo gem install gh
gh pull-request [user] [branch]
其他人提到了github的官方中心包:
sudo apt-get install hub
or
brew install hub
then
hub pull-request [-focp] [-b <BASE>] [-h <HEAD>]
更新:hub命令现在是一个官方的github项目,也支持创建拉请求
原:
似乎在hub命令中添加一个特别有用的东西:http://github.com/defunkt/hub或github gem: http://github.com/defunkt/github-gem
我建议将问题提交给那些需要它的项目。github的人都很有反应。
推荐文章
- 为什么我需要显式地推一个新分支?
- 如何撤消最后的git添加?
- Rubymine:如何让Git忽略Rubymine创建的.idea文件
- Gitignore二进制文件,没有扩展名
- Git隐藏错误:Git隐藏弹出并最终与合并冲突
- 了解Git和GitHub的基础知识
- 没有。Git目录的Git克隆
- 在GitHub上有一个公共回购的私人分支?
- Git与Mercurial仓库的互操作性
- 忽略git中修改(但未提交)的文件?
- 只用GitHub动作在特定分支上运行作业
- “git restore”命令是什么?“git restore”和“git reset”之间有什么区别?
- Git合并与强制覆盖
- Git拉另一个分支
- 是否有一个链接到GitHub下载文件的最新版本的存储库?