BitBucket - 创建存储库和子模块

BitBucket - Create repository and sub modules

我正在使用 bitbucket 网络界面并创建了一个新项目 "Test_Project"。 在这个项目中,我能够创建一个新的存储库 - 'Module1' 使用 Create repository 选项。

现在我想在 bitbucket 项目中创建存储库层次结构 - Test_Project 如下:-

Test_Project(Bitbucket 项目)

以便我将本地项目添加到相应的 bitbucket 子存储库中

任何人都可以指导如何在 bitbucket 的新存储库中创建 sub-repositories/sub-modules。

您只需要在您的根文件夹中,然后添加子模块文件夹。

git submodule add <url>

现在,当您克隆项目时,您只需初始化并更新子模块

git submodule init
git submodule update

Git 1.8.2 提供了一个新选项 --remote

git submodule update --remote --merge

会从每个子模块中的上游获取最新的更改,将它们合并,并检查子模块的最新修订。正如 the docs 所说:

--remote

This option is only valid for the update command. Instead of using the superproject’s recorded SHA-1 to update the submodule, use the status of the submodule’s remote-tracking branch.

这相当于运行 git拉入每个子模块。


Git 2.8 update

Parallel fetches of submodules

Using git submodules, one Git repository can include other Git repositories as subdirectories1. This can be a useful way to include libraries or other external dependencies into your main project. The top-level repository specifies which submodules it wants to include, and which version of each submodule.

When you fetch into the top-level repository, you typically want to fetch into the submodule repositories as well:

git fetch --recurse-submodules

If you have a lot of submodules, all of these fetches can be time-consuming; git fetch is essentially run in each submodule in turn.

But now you can speed things up by fetching from multiple submodules in parallel. For example,

git fetch --recurse-submodules --jobs=4

现在,我可以使用 sub-repository/sub-folders 创建 Bitbucket 存储库结构。

请按照以下步骤操作:-

  1. 在 Bitbucket 项目中创建一个新的存储库。
  2. 要与您的新存储库交互,您需要使用 git 客户端将此存储库克隆到您的本地计算机。 我正在使用“SourceTree”作为 GIT 客户端(另一个 Atlassian 产品,与 Bitbucket 集成良好,您可以使用 Bitbucket 中的 "Clone To SourceTree" 按钮使事情变得更容易)。
  3. 一旦您有了本地存储库,copy/move 将您的项目放入其中,并使用您选择的工具 add/commit 文件并将它们推送到 bitbucket。

谢谢,

怡保