![](/img/trans.png)
[英]What is a practical way for maintaining a secret (from public) patch to a git repo?
[英]A practical way to approach maintaining code bundles in git
我正在一个项目中,我们有多个从通用基础插件继承的插件。 我们正在尝试找到一种以实际方式使用git的方法。
Example Repo:
OfficePlugin [directory containing several .cs files and a .csproj]
CopyPlugin [directory with .cs files and .csproj. Class inherits from OfficePlugins]
CutPlugin [directory with .cs files and .csproj. Class inherits from OfficePlugins]
PastePlugin [directory with .cs files and .csproj. Class inherits from OfficePlugins]
FontPlugin [directory with .cs files and .csproj. Class inherits from OfficePlugins]
DecorationsPlugin [directory with .cs files and .csproj. Class inherits from OfficePlugins]
好的,因此在此示例中,在这种情况下,我们有一个名为OfficePlugin的基础项目。 (C#项目包含捆绑在一起的多个文件,但这可能是任何语言的问题。)
假设我们有3位程序员从事项目。
Mark (Our I/O guy):
CopyPlugin
CutPlugin
PastePlugin
Nancy (Out Font manager):
FontPlugin
FontDecorationsPlugin
Joe (The cross department integrator):
FontDecorationsPlugin
PastePlugin
在正常的git设置下,所有这些文件都存储在一个仓库中(据我所知),我们的程序员将不得不忽略他们无法控制的目录。 很好,没问题。
但是,假设乔添加了一种特殊的粘贴功能,当您将文本从一个文档粘贴到另一个文档时,该粘贴可以保留字体样式。 其次是几次提交。
Commit Log
Commit: 12345 Author: Mark CopyPlugin Enhancements
Commit: 23456 Author: Nancy FontPlugin Speed Profiling
Commit: 34567 Author: Joe PastePlugin Font Decoration Ability
Commit: ABCDE Author: Mark Update of all I/O Plugins
在这一点上,马克和乔意识到乔的改变是一个重大的改变。 PastePlugin的目录需要回滚以提交ABCDE,但是FontPlugin和CopyPlugin上的更改不希望丢失。
除了我们有接近150个插件外,我也有类似情况。 150个回购协议(每个插件一个)似乎很疯狂,我每个人都需要一份OfficePlugin。
SubModule或SubRepo看起来可能是一个不错的选择,但是不能确定在添加或删除其他存储库时使用Bamboo进行自动构建是否可行。
可以做一些疯狂的分支计划并合并,但这听起来确实很痛苦。 另一个选择是找到确切的提交并检出该目录中的每个文件。 该选项似乎很麻烦,尤其是如果我们需要返回2次commit并浏览日志以查看3个月前可能在哪里。
另一种选择可能是以某种方式标记? 但是我认为这与检出特定目录一样具有挑战性。
有没有实际的方法来处理这种情况?
我只会使用具有良好路径结构的单个存储库。
要回滚示例中的这个插件非常简单:
cd PastePlugin
git checkout ABCDE -- .
git commit
而已。
阅读有关Google如何构建其git存储库(重点是y )的灵感,尽管他们的方法是许多年工作的结果。 但是要吸取的教训是,很可能在单个存储库中包含许多项目,并且使用工具(例如脚本,挂钩等)可以实现很多目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.