【问题标题】:I have made 2 git repositores in one directory. Now I want to get rid of one of them. How do I go about that?我在一个目录中创建了 2 个 git 存储库。现在我想摆脱其中之一。我该怎么做?
【发布时间】:2021-02-21 01:55:17
【问题描述】:

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

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

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

.gitone
.gittwo
all_other_files
.gitignore

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

.git
all_other_files
.gitignore

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

【问题讨论】:

  • 请问您为什么要创建两个存储库?该方法试图解决哪个问题?
  • 在项目开始时,我认为让我们有 2 个存储库,一个用于我工作的组织,另一个用于我自己。但后来意识到这是浪费。我按照answer 制作了 2 个存储库。

标签: git github repository multiple-repositories


【解决方案1】:

从纯粹的外壳角度来看:

rm -Rf .gittwo
mv .gitone .git

# Check with:
git status
git log

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

【讨论】:

  • 谢谢,它成功了。是的,在 1 个文件夹中有 2 个存储库是不寻常的,我有点尝试。
  • 实验很好,从实验中学习更好。祝你的 git 之旅好运:)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-09
  • 2023-01-04
  • 1970-01-01
  • 2011-02-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多