[英]Git local repository management
I am quite new to git but the advantages to use it are quite clear! 我对git很陌生,但是使用它的好处非常明显! I have been developing for iOS and I have created some custom class of mine that I share among several projects, I would like to keep them centralized so I can pull and push only from/in a single place, and only that specific folder will be always up to date with the latest changes, that can come from different projects.
我一直在为iOS开发,并创建了我的自定义类,我在多个项目中共享该类,我希望将它们集中化,这样我就只能从一个地方拉/推,并且只有该特定文件夹才是始终保持最新状态,这些变化可能来自不同的项目。
How can I setup practically a scenario like this? 我实际上如何设置这样的场景? I really thank you in advance!
我真的非常感谢你!
You can think about a git repository in one of 2 ways: 您可以通过以下两种方式之一来考虑git存储库:
If you think of it as a git owned / controlled repository then you might want to add other repositories to it. 如果您将其视为git拥有/控制的存储库,则可能需要向其添加其他存储库。 These are called submodules.
这些称为子模块。 It's a way of including one repository's contents into another.
这是将一个存储库的内容包含到另一个存储库中的一种方法。 Read enter link description here .
在此处阅读输入链接描述 。 Doing this means that everything will be under a single folder and if you clone the repository you'll get everything required for the project.
这样做意味着所有内容都将在一个文件夹中,并且如果您克隆存储库,则将获得项目所需的所有内容。
If you think of it as just a folder of stuff that Xcode uses then there is no reason that Xcode needs to refer to only one folder. 如果您将其仅视为Xcode使用的资料的文件夹,则没有理由Xcode只需要引用一个文件夹。 You can have multiple repositories cloned to different locations on your machine and files from each of them included in your project.
您可以将多个存储库克隆到计算机上的不同位置,并将项目中包含的每个存储库克隆到其中的文件。 In some ways this is simpler than submodules, but it limits you to always having each of the repositories cloned to the same (relative) locations (only really a concern when you're cloning to a different machine).
在某些方面,这比子模块要简单,但它限制了您始终将每个存储库都克隆到相同(相对)的位置(克隆到另一台计算机时才真正需要考虑)。
If you're working alone then the submodules approach may be more in-depth than you care for. 如果您是一个人工作,那么子模块方法可能比您关心的更深入。 If you're working in a team then it can be a boon (with instructions on what to do when updating the submodules doesn't work properly...).
如果您在团队中工作,那将是一个福音(有关更新子模块时无法正常工作的说明...)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.