应用 Thunderbird 的 git 系列补丁的最简单方法是什么

发布于 2024-12-10 14:58:48 字数 377 浏览 0 评论 0原文

我有一封邮件,其中包含 N 个附件,格式为 000X-xxxx.patch。我想将所有补丁应用到我的 master 之上,但我希望将所有提交分开,因为原始作者提交了它们。当然包括提交消息。

方法一:打开电子邮件,单击“另存为,xxx.eml”,然后:

git am xxx.eml

结果没问题,但所有内容都被压缩为一次提交。不可接受。

方法2.所有附件都保存在一个目录下,那么:

git am 000*.patch
Patch format detection failed.
git apply 000*.patch
(does nothing)

这个不行。建议?谢谢。

I have a mail with N attachments in the 000X-xxxx.patch format. I would like to apply all the patches on top of my master, but I would like to have all the commits separate, as the original author commited them. Including the commit message of course.

Method 1: Open the email, click Save as, xxx.eml and then:

git am xxx.eml

The result is ok, but everything is squashed into one commit. Not acceptable.

Method 2. All the attachments are saved in a directory, then:

git am 000*.patch
Patch format detection failed.
git apply 000*.patch
(does nothing)

This is not working. Advices? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

徒留西风 2024-12-17 14:58:48

通读 git am 手册页,看起来提交消息是由主题:行和消息正文组成的,这意味着您将无法重新创建原始序列提交(也就是说,没有办法恢复作者用于每个单独提交的提交消息)...尽管根据手册页, git am 旨在使用内联补丁,没有作为附件包含补丁,所以我很惊讶它是即使在方法 1 中也能做正确的事情。

如果您愿意放弃提交消息,您应该能够将补丁保存到各个文件中,然后按顺序 git apply ... 它们。

Reading through the git am man page, it looks like the commit message is formed from the Subject: line and the message body, which means that you're not going to be able to recreate the original sequence of commits (that is, there's no means by which to recover the commit message the author used for each individual commit)...although according to the man page, git am is meant to work with inline patches, not patches included as attachments, so I'm surprised it's doing the right thing even in method 1.

If you're willing to discard the commit messages, you should be able to save the patches to individual files and just git apply ... them in sequence.

时光无声 2024-12-17 14:58:48

据我所知,Thunderbird 没有一个合理的
同时将多封电子邮件保存为单独文件的方法。你可以
不过,一次保存一个,这对于小型补丁集确实有效。

讽刺的是,我无意中发现了最简单的方法:将 Linux 补丁发送给一位不遵循邮件列表的同事。转发他们
给你自己(作为附件)。

  1. 选择所有补丁电子邮件
  2. 将它们作为附件转发给自己
  3. 将所有附件保存到适当的目录
  4. 应用电子邮件。例如“git am my_patch_dir/[PATCH -v5*”

As far as I have been able to find, Thunderbird does not have a sensible
way to save several emails as individual files at the same time. You can
save them one at a time, though, and this does work for small patch sets.

Ironically, I accidentally discovered the easiest way by sending Linux patches to a colleague who doesn't follow the mailing lists. Forward them
To yourself (as attachments).

  1. Select all the patch emails
  2. Forward them to yourself as attachments
  3. Save all attachments to an appropriate directory
  4. apply the emails. e.g "git am my_patch_dir/[PATCH -v5*"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文