我已经在一个目录中制作了2个git repositores现在,我想摆脱其中之一我该怎么做?

问题描述

这些是我用来在1个文件夹中创建2个存储库的命令。

git init .
mv .git .gitone
git init .
mv .git .gittwo 

现在我的文件夹结构看起来像

.gitone
.gittwo
all_other_files
.gitignore

我想删除第二个存储库,以使我的新文件夹结构看起来像这样

.git
all_other_files
.gitignore

我对如何进行此操作感到困惑。我在两个存储库中都有等效的代码和提交。任何帮助将不胜感激。

解决方法

从纯粹的shell角度来看:

rm -Rf .gittwo
mv .gitone .git

# Check with:
git status
git log

但是在一个文件夹中有两个存储库是不寻常的。
任何git命令都必须指定其--git-dir.gitone.gittwo