[英]Merging changes from a public repository into a private build
Assume I clone a repository OSS
at version 1.0 containing a class A
.假设我克隆了 1.0 版的存储库
OSS
,其中包含 class A
。 Subclassing A
is not enough for me, so I copy A
to A'
and make some modifications to it.子类化
A
对我来说还不够,所以我将A
复制到A'
并对其进行一些修改。 At a later point in time, I clone OSS
at version 1.1
, containing an updated version of A
.稍后,我将
OSS
克隆到1.1
版本,其中包含A
的更新版本。 How can I merge the changes/updates from A
to my modified copy A'
?如何将
A
中的更改/更新合并到我修改后的副本A'
? Is there a standard pattern for such cases?这种情况有标准模式吗?
The idea is to:这个想法是:
create the patch using git diff
: between A#1.0 and 1#1.0使用
git diff
创建补丁:在 A#1.0 和 1#1.0 之间
git diff 1.0 1.1 -- A > a.patch
then apply that patch using the patch
utility: you can specify the file you want to apply the diff to with patch
.然后使用
patch
实用程序应用该补丁:您可以使用patch
指定要将差异应用到的文件。
patch -p1 A' a.patch
On Windows, use a simplified PATH as in here , and you will see patch available:在 Windows 上,使用此处的简化路径,您将看到可用的补丁:
C:\git\>where patch
C:\prgs\gits\current\usr\bin\patch.exe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.