如何使用git am从电子邮件中应用补丁?

问题描述 投票:24回答:3

我非常熟悉git(基本的东西至少分支,合并,与同行等合作)但是前几天我的一个朋友告诉我,我们可以在我们的邮箱中使用git。涉及的包是git-am(manual page here)。

请有人帮我开始使用git-am。

git
3个回答
22
投票

涉及的另一件大事是git format-patch。这将创建要通过电子邮件发送的补丁;然后可以使用git send-email或直接发送它们。例如:

# create a patch for each commit from origin's master to yours
git format-patch origin/master..master

# now send them... 
# there are a zillion options here, and also some configuration; read the man page
git send-email [email protected] [email protected] ... *.patch

git am将接受format-patch创建的补丁,并按顺序应用它们,例如:

git am *.patch

你必须弄清楚如何从你的邮件客户端自己导出mbox格式的补丁,不过我想你也可以简单地将它们作为附件发送或直接传输它们。

您可以在一个存储库中完成自己的尝试,看看它是如何工作的。如上所述创建一组补丁,然后检查起点,并使用git am应用补丁。


3
投票

您需要一个可以将邮件导出为mbox文件的邮件客户端。导出邮件并运行git-am your-mbox-file。完成。


2
投票

拼凑而成的解决方法

https://github.com/getpatchwork/patchwork

由于似乎没有人知道如何使用随时可用的工具将电子邮件转换为mbox,许多基石恐龙项目项目都有一个相关的,有时是官方推荐的拼凑实例运行,其中许多托管在https://patchwork.ozlabs.org/上,例如:

Patchwork订阅列表,并解析git send-email生成的补丁,并允许您下载补丁。

是的,还有另一个工具层在电子邮件之上......

Thunderbird导出到mbox

问:What is the easiest way to apply git series of patches from Thunderbird到目前为止没有答案。

也可以看看

© www.soinside.com 2019 - 2024. All rights reserved.