简体   繁体   English

将公共存储库中的更改合并到私有构建中

[英]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.

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