是否可以从命令行在纯 Git 中创建合并请求?
我正在使用防火墙后安装的 Gitorious。
我可以进入 Web 应用程序并从克隆创建拉取请求,并定位从中克隆它的主存储库。
我希望能够在命令行上执行此操作。更具体地说,我希望能够从命令行打开从一个分支到另一个分支(而不是从克隆到种子存储库)的合并请求。
由于我没有使用 Github,因此无法使用 Github 特定工具或库。这可能吗?
I'm using a behind-firewall install of Gitorious.
I can go into the web application and create a pull request from a clone and target the master repo from which it was cloned.
I'd like to be able to do this on the command line. More specifically, I'd like to be able to open merge requests from the command line from one branch to another (rather than from clone to seed repo).
Since I'm not using Github, I can't use Github specific tools or libraries. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
svick给出的答案不正确。这是可能的。
有
git request-pull
这是 Git 套件的一部分。使用该命令行工具,您可以创建一个可以通过电子邮件发送的拉取请求。示例:
您的
origin
拥有一个分支master
。现在,您创建一个本地错误修复分支fix
,实现错误修复并将该fix
分支推送到origin
:然后,您希望有人合并
fix
分支中所做的更改进入master
。创建拉取请求这将创建一个格式如下的文本:
如果合并请求将发送给无法访问您推送更改的存储库的人,那么总是有机会使用
git 格式补丁
。将
fix
分支推送到origin
后(您甚至不需要这样做),在fix
分支上使用以下命令创建补丁这将为您自分支
master
以来在fix
中所做的每次提交创建一个补丁文件。您可以将生成的.patch
文件捆绑在一起,然后通过电子邮件等方式发送给某人以供审核和应用。
为了完整起见:应用补丁可以通过 来完成
git am
。The answer given by svick is not correct. It is possible.
There's
git request-pull
which is part of the Git suite. Using that command line tool, you could create a pull request that could be sent per E-Mail.Example:
your
origin
holds a branchmaster
. Now you create a local bugfix branchfix
, implement the bug fix and push thatfix
branch toorigin
:Then, you want someone to merge the changes made in the
fix
branch intomaster
. Create the pull request withThis will create a text formatted as follows:
If the merge request shall go to somebody that cannot access your repo where you pushed your changes, there's always the opportunity of doing it with
git format-patch
.After pushing your
fix
branch toorigin
(you don't even need to do that), while being on thefix
branch create the patch usingThis will create a patch file for each commit you did in
fix
since branching offmaster
. You could bundle the generated.patch
files withand then send to someone e.g. via E-Mail to review and apply.
For the sake of completeness: applying the patches could be done with
git am
.Gitlab 从 v11.10 开始添加此功能。提交最终更改后,只需使用:
创建合并请求,而不是
push
。更多详细信息请参阅 push 文档 或 合并请求文档。Gitlab add this feature from v11.10. After committing your final changes, instead of
push
simply use:to create a merge request. More details in push docs or merge request docs.
您可以使用此命令行工具: https://github.com/brauliobo/gitorious-merge-request
You may use this command line tool: https://github.com/brauliobo/gitorious-merge-request
git 本身不存在“合并请求”这样的东西。因此,如果这是可能的,则需要特定于您的 git 主机的东西。
There is no such thing as “merge request” in git itself. So, if this would be possible, it would require something specific to your git host.