Han*_*Jun 5 git shared repository subtree visual-studio-2015
我是 Git 版本控制的新手。我只希望每个项目都有自己的存储库。
我创建
文件夹结构如下。
D
-B
- 一种
-C
- 一种
如您所见,文件夹重复,并且我无法在 Visual Studio 中两次添加相同的项目。
如果我在 B 文件夹中添加 A 项目,则会发生编译错误。
元数据文件项目 C..... 'A.dll' 无法找到 因为 C 文件夹中的 A 项目从未被编译,所以缺少 A.dll。
如果C工程中的A编译一次就可以了。(通过打开C工程中的C.sln或A.sln)当然会有A.dll,
但是下次别人从git下载D项目时,他/她应该在编译D项目之前在C项目中编译C或A。
任何人都有一个很好的解决方案?
You can try and read about submodules.
\n\n\n\n
Submodulesallow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.
git submoduleBreak your big project to sub projects as you did so far.
\nNow add each sub project to you main project using :
git submodule add <url>\nRun Code Online (Sandbox Code Playgroud)\nOnce the projected is added tot your repo you have to init and update it.
\ngit submodule init\ngit submodule update\nRun Code Online (Sandbox Code Playgroud)\nAs of Git 1.8.2 new option --remote was added
git submodule update --remote --merge\nRun Code Online (Sandbox Code Playgroud)\nwill fetch the latest changes from upstream in each submodule, merge them in, and check out the latest revision of the submodule.
As the docs describe it:
\n\n\n\n
--remote该选项仅对更新命令有效。不要使用 superproject\xe2\x80\x99s 记录的 SHA-1 来更新子模块,而是使用 submodule\xe2\x80\x99s 远程跟踪分支的状态。
\n
这相当于在每个子模块中运行 git pull。
\n\n\n但是,在 C 中的错误修复影响与父层共享的代码的情况下,我将如何推送提交?
\n
再次强调:使用子模块会将您的代码放置在主项目中作为其内容的一部分。将其放在本地文件夹内或将其作为子模块的一部分之间的区别在于,在子模块中,内容被管理(提交)到不同的独立存储库。
\n这是另一个项目中的子模块 - 项目的图示,其中每个项目都是一个独立的项目。
\n\ngit subtreeGit 子树允许您插入任何存储库作为另一个存储库的子目录
\n非常类似于submodule但主要区别在于代码的管理位置。在子模块中,内容放置在单独的存储库中并在那里进行管理,这允许您将其克隆到许多其他存储库。
subtree将内容作为根项目的一部分进行管理,而不是在单独的项目中进行管理。
您无需写下如何设置它并了解如何使用它,您只需阅读这篇优秀的文章即可解释这一切。
\nhttps://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/
\n| 归档时间: |
|
| 查看次数: |
4114 次 |
| 最近记录: |