git子模块-我想从更高的git存储库设置更低的存储库项目



当我开始使用GIT时,我不熟悉项目代码,只想将所有代码置于源代码控制之下。项目层次结构如下:

/Projects/.git  # I put the git repository here, which I think was a big mistake.
/Projects/Project1
/Projects/Project2
/Projects/Project3
/Projects/Project4
/Projects/Project5

有一次,我创建了一个子存储库:

/Projects/.git (now it contains all of /Projects/Project3/.git changes too)
/Projects/Project1
/Projects/Project2
/Projects/Project3
/Projects/Project3/.git    # I think this will compound the problem of seperation
/Projects/Project4
/Projects/Project5

我真正想做的是:

/Projects/(no .git here)
/Projects/Project1/.git
/Projects/Project2/.git
/Projects/Project3/.git
/Projects/Project3/.git
/Projects/Project4/.git
/Projects/Project5/.git

我看过过滤器分支,但不太明白如何使用它将历史从较高的/Projects/.git存储库中提取到单独的较低的/Projections/Project[1-5]/.git存储库中。

我环顾四周,发现有一个新的git子模块工具。我想知道这是否是我应该尝试使用的,但我不确定。

有人知道如何将这些项目分离到单独的存储库中,这样我就可以摆脱覆盖整个项目集的上层存储库吗?

如有任何帮助,我们将不胜感激。

Alan

如果你不关心历史,你可以做以下事情:

在每个项目文件夹中:

git init .
git remote add origin <remote-repo-url e.g. github.com/kae/project1.git>
git add .
git commit -m "Initial Commit"
git push origin master

这样,您的所有代码都将在自己的回购中。为了安全起见,删除外部/Projects/.git

相关内容

  • 没有找到相关文章

最新更新