[英]Git and cloning
I have done an app for a client called 'A' (not really). 我已经为一个名为“ A”的客户开发了一个应用程序(不是真的)。
I have found out that it is very cool and that I want to sell it to other clients also. 我发现它非常酷,我也想将其出售给其他客户。 The directory 'A' is a Git repository. 目录“ A”是一个Git存储库。 I think I have a problem with cloning it. 我认为克隆有问题。 As far as I can see I need to make a copy of the dir 'A' and call it 'Generic_A'. 据我所知,我需要复制目录“ A”并将其命名为“ Generic_A”。 Then delete the dir 'A' and do a "git clone Generic_A A" Then I could start changing the 'Generic_A'-repo with a generic design and all client references removed. 然后删除目录“ A”并执行“ git clone Generic_A A”,然后我可以开始更改具有通用设计的“ Generic_A” -repo,并删除所有客户端引用。 But that is kind of the other way around. 但这是另一回事。 I should have started doing the generic design and then cloned the repo to change to the client specific design. 我应该开始进行通用设计,然后克隆存储库以更改为特定于客户的设计。
Can I: 我可以吗:
And if yes - how do I make the patch and apply it? 如果是,我该如何制作补丁并应用它?
Regards, 问候,
Jacob 雅各
Here a possible work-flow : 这是一个可能的工作流程:
This way, you will keep the history of the client-A branch. 这样,您将保留client-A分支的历史记录。
That could work, although between 6. and 7. I would make a 'client_A' branch before applying your patch. 即使在6到7之间,也可以使用。在应用补丁之前,我将创建一个'client_A'分支。
The drawback is that you lose commit history specifics to client A, since you apply that patch in one big commit. 缺点是您会丢失对客户端A的提交历史记录详细信息,因为您是在一次大提交中应用了该补丁的。
In your case, a patch can be made with git diff
, see patching with git diff 在您的情况下,可以使用git diff
制作补丁 ,请参见使用git diff进行补丁
git diff --no-prefix > patchfile
then apply the patch: 然后应用补丁:
patch -p0 < patchfile
If you have an existing "
git diff
" patch file that was created without the "--no-prefix" option, you can apply that patch via: 如果您已经创建了不带“ --no-prefix”选项的现有“git diff
”补丁文件,则可以通过以下方式应用该补丁:
patch -p1 < patchfile
this will ignore the default a/ b/ source prefixes. 这将忽略默认的a / b /源前缀。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.