git bundle单提交? [英] Git bundle single commit?
问题描述
我要应用包括其提交消息的补丁程序,如何捆绑单个提交并应用它?/p>
给出示例历史记录:
0a8b835 intel_pmc_ipc:添加英特尔Apollo Lake PMC IPC驱动程序0d44b41 tc1100-wmi:在功能调用"kfree"之前删除不必要的检查b8830a4 dell-laptop:修正分配&释放SMI缓冲区页面2ec1e9e目标:将核心版本升级到v5.0
- 说我想将
0d44b41
捆绑为001.bundle
并应用吗? - 说我想将
b8830a4
-通过-0d44b41
捆绑为002.bundle
,并应用它?
注意:我已经可以使用补丁文件执行此操作,但是我还希望自动包含commit mes.
我尝试遵循捆绑销售的git-scm文档使用此命令,失败为:
$ git bundle create 001.bundle 0d44b41 ^ 0d44b41致命的:拒绝创建空捆绑.
我不确定您为什么要专门限制自己使用 git bundle
,而是假设您这样做为此,请在文档:
git-rev-list-args
git rev-parse
和git rev-list
可接受的参数列表(并包含命名的引用,请参见指定参考下方),用于指定要传输的特定对象和参考....指定参考
git bundle
将仅打包由git show-ref
显示的引用:这包括磁头,标签和远程磁头.
现在考虑您的命令:
$ git bundle create 001.bundle 0d44b41 ^ 0d44b41
create 001.bundle
指定要创建的文件.命令行的其余部分 0d44b41 ^ 0d44b41
是 git-rev-list-args
.您在这里使用了什么参考(分支或标签名称)? 1
请注意, git format-patch
包含提交消息(和作者),使用 git am
将应用包含原始消息(和作者)的提交,尽管您会成为提交者,除非您执行其他一些设置工作.
1 当然,这是反问的:您没有使用过.我不确定为什么 git bundle
如此坚持,因为您可以轻松地将引用附加到原始SHA-1,制作捆绑包,然后再次删除引用而不会干扰-创建了捆绑包.那将使您能够做自己想做的事情.或者,当然,如果有一个名称(例如分支或标记)指向您要捆绑的单个提交,则可以直接使用该现有名称.
I want to apply a patch including its commit message, how do I bundle a single commit and apply it?
Given example history:
0a8b835 intel_pmc_ipc: Add Intel Apollo Lake PMC IPC driver
0d44b41 tc1100-wmi: Delete an unnecessary check before the function call "kfree"
b8830a4 dell-laptop: Fix allocating & freeing SMI buffer page
2ec1e9e target: Bump core version to v5.0
- Say I wanted to bundle
0d44b41
as001.bundle
, and apply it? - Say I wanted to bundle
b8830a4
-through-0d44b41
as002.bundle
, and apply it?
Note: I can already do this with patch files, but I want to also include the commit mes automatically.
I tried to follow the git-scm doc on bundle with this command, which fails as:
$ git bundle create 001.bundle 0d44b41^ 0d44b41
fatal: Refusing to create empty bundle.
I'm not sure why you want specifically to limit yourself to git bundle
, but assuming you do want that, take note of this wording in the documentation:
git-rev-list-args
A list of arguments, acceptable to
git rev-parse
andgit rev-list
(and containing a named ref, see SPECIFYING REFERENCES below), that specifies the specific objects and references to transport. ...SPECIFYING REFERENCES
git bundle
will only package references that are shown bygit show-ref
: this includes heads, tags, and remote heads.
Now consider your command:
$ git bundle create 001.bundle 0d44b41^ 0d44b41
The create 001.bundle
specifies the file to create. The remainder of your command-line, 0d44b41^ 0d44b41
, are the git-rev-list-args
. What reference (branch or tag name) did you use here?1
Note that git format-patch
includes commit messages (and author), and using git am
will apply the commit including the original message (and author, though you will be the committer unless you do some additional setup work).
1Rhetorical question, of course: you did not use any. I'm not sure why git bundle
is so very insistent on one, since you can easily attach a reference to a raw SHA-1, make the bundle, then remove the reference again without disturbing the just-created bundle. That would allow you to do what you're attempting. Or, of course, if there is a name (branch or tag for instance) pointing to the single commit you want bundled, you can use that existing name directly.
这篇关于git bundle单提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!