使用远程分支的特定文件夹跟踪项目的特定本地文件夹

Track project's particular local folder with remote branch's particular folder

我想将本地仓库的一个特定文件夹连接到 github.com

上的远程仓库的特定文件夹

我项目的本地和远程结构示例。 (例如CodeIgniter/PHP结构)

我的本地 Repo 结构 =>

C:\wamp64\www\myproject\
    admincp
        assests_admin
        index.php
    application
        admincp
            config
            controllers
            models
            views
        front
            config
            controllers
            models
            views
        language
    assests_front
    uploads
    userfiles
    vendor
    index.php

我的Git远程回购结构(私人回购)=>在远程回购中,我只有以下文件夹。

此外,我刚刚在此处 master 分支。

https://github.com/username/myproject/
    assests_admin
    admincp
        config
        controllers
        models
        views
    assests_front
    front
        config
        controllers
        models
        views

现在我想用远程回购 https://github.com/username/myproject/admincp 文件夹及其所有内容跟踪本地 C:\wamp64\www\myproject\application\admincp 文件夹(及其所有子文件夹和文件)。

与跟踪本地 C:\wamp64\www\myproject\application\front 文件夹(及其所有子文件夹和文件)和远程回购 https://github.com/username/myproject/front 文件夹及其所有内容相同。

问题1=>这种情况可能吗?

Que 2=> 如果可能的话,我必须在哪个本地文件夹中使用 运行 $git init 命令来实现上述场景?之后 configremote add 命令 运行?请告诉我完整的程序。

提前致谢。

假设 admincp 是本地 Git 存储库(意味着您已在该文件夹中创建 git init .,添加并提交),您可以:

  • 推送 admincp 到它自己的 GitHub 存储库
  • 在您的 myproject 父 GitHub 存储库中引用该存储库,admincp 作为 submodule