简体   繁体   English

如何使用git应用一系列补丁

[英]How to apply a serie of patches with git

It is convenient to send sets of patches using git send-email . 使用git send-email补丁集很方便。 But once I received a set of patch, how to apply them? 但是,一旦收到一组补丁,该如何应用它们? Especially, how to apply them in right order? 特别是,如何以正确的顺序应用它们?

If I save them in a separate Maildir and I give this Maildir in argument to git am , patches are not applied in right order. 如果我将它们保存在单独的Maildir中,并且将此Maildir作为参数提供给git am ,则补丁的应用顺序不正确。

Currently, I specify each file separately on git am command line, but it's tedious. 目前,我在git am命令行上分别指定每个文件,但这很繁琐。

One of solutions would be: 解决方案之一是:

git am $(perl -e  'my @r = sort { `grep Subject: $a` cmp `grep Subject: $b` } @ARGV; print "@r"' Maildir/new/*)

I strongly dislikes this hack. 我非常不喜欢这种黑客手段。 Is anyone has a better idea? 有谁有更好的主意吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM