假设我的设置看起来很像
phd/code/
phd/figures/
phd/thesis/
Run Code Online (Sandbox Code Playgroud)
由于历史原因,这些都有自己的git存储库.但我想将它们合并为一个,以简化一些事情.例如,现在我可能会进行两组更改,并且必须执行类似的操作
cd phd/code
git commit
cd ../figures
git commit
Run Code Online (Sandbox Code Playgroud)
表演(现在)很棒
cd phd
git commit
Run Code Online (Sandbox Code Playgroud)
似乎有几种方法可以使用子模块或从我的子存储库中提取,但这比我正在寻找的要复杂一些.至少,我很高兴
cd phd
git init
git add [[everything that's already in my other repositories]]
Run Code Online (Sandbox Code Playgroud)
但这似乎不是一个单行.有什么git可以帮助我吗?
我有以下文件夹结构:
foo/
foo/bar
foo/baz
foo/bee
Run Code Online (Sandbox Code Playgroud)
我在foo/bar/.git上创建了一个git存储库.
后来我意识到我需要在foo存储库中包含foo中的所有其他目录,所以我在foo/.git上创建了一个git存储库.
foo/.git
foo/bar/.git
foo/baz
foo/bee
Run Code Online (Sandbox Code Playgroud)
我可以删除foo/bar/.git但我希望能够保留git存储库的历史记录,但是在foo/.git中而不是foo/bar/.git.
我试图阅读子模块,但如果我理解正确,它是一种将现有存储库的版本集成为您自己的存储库的子树的方法.
我不完全确定这是我需要的.我不需要保持foo/bar/.git.我希望foo/.git成为我的主存储库.我只是想知道是否有办法在foo/.git中保存或整合foo/bar/.git的历史记录,这样我就可以删除foo/bar/.git.