Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows 如何在不同的目录中跟踪git存储库?_Windows_Git_Git Submodules - Fatal编程技术网

Windows 如何在不同的目录中跟踪git存储库?

Windows 如何在不同的目录中跟踪git存储库?,windows,git,git-submodules,Windows,Git,Git Submodules,所以我有一个项目是git repo,它包含另一个git存储库。所以结构是这样的: /gitProject /other /stuff /anotherGitProject 目前,我已经将另一个gitProject设置为gitProject的子模块。我的问题是,我必须将另一个Git项目部署到硬盘的另一部分。由于另一个GitProject的功能是一个附加组件,因此我只需将另一个GitProject的内容直接复制到另一个项目的目录树中: /gitProject /ot

所以我有一个项目是git repo,它包含另一个git存储库。所以结构是这样的:

/gitProject
    /other
    /stuff
    /anotherGitProject
目前,我已经将另一个gitProject设置为gitProject的子模块。我的问题是,我必须将另一个Git项目部署到硬盘的另一部分。由于另一个GitProject的功能是一个附加组件,因此我只需将另一个GitProject的内容直接复制到另一个项目的目录树中:

/gitProject
    /other
    /stuff
    /anotherGitProject
/otherProject
    /(contents of anotherGitProject+otherProject)
我的问题是:如何跟踪我对gitProject中另一个gitProject所做的更改?这似乎真的很复杂,但我需要在其他项目的基础上对另一个Git项目进行更改,否则这不会成为问题。

我的想法是:

  • otherProject
    中克隆另一个GitProject,
    或者甚至作为其他项目(如果
    其他GitProject
    的内容需要直接在
    其他项目
    中,在这种情况下:
    • otherProject.tmp
    • 将另一个GitProject克隆为另一个项目
    • 复制
      otherProject.tmp中
      otherProject.tmp的其余内容
    • 添加.gitignore以忽略任何不是另一个GitProject的原始内容
  • 另一个gitProject
    初始回购(该回购是
    gitProject
    的子模块)添加指向
    otherProject
这样,您就可以从
otherProject
直接返回到
anotherGitProject

如果
anotherGitProject
作为一个插件是
otherProject
的一个简单子目录,那么过程就简单得多,因为正如我在第一点中提到的,您可以直接在目标中克隆
anotherGitProject

远程步骤相同:

cd /gitProject/anotherGitProject
git add remote anotherGitProjectDeployed /path/to/otherProject/anotherGitProject

谢谢你的帮助。对我来说,关键是为另一个gitProject创建一个remote。因为我没有它,所以我必须在github上创建我自己的版本,然后将它用作gitProject中的子模块。