git - 我在一个目录中创建了 2 个 git 存储库。现在我想摆脱其中之一。我该怎么做?
问题描述
这些是我用来在 1 个文件夹中创建 2 个存储库的命令。
git init .
mv .git .gitone
git init .
mv .git .gittwo
现在我的文件夹结构看起来像
.gitone
.gittwo
all_other_files
.gitignore
我想删除第二个存储库,使我的新文件夹结构看起来像这样
.git
all_other_files
.gitignore
我对如何进行这件事有点困惑。我在两个存储库中都有等效的代码和提交。任何帮助,将不胜感激。
解决方案
从纯粹的外壳角度来看:
rm -Rf .gittwo
mv .gitone .git
# Check with:
git status
git log
但是在一个文件夹中有两个存储库是不寻常的。
任何 git 命令都必须指定其--git-dir
(.gitone
或.gittwo
)
推荐阅读
- python - 在 python dbf 中使用特殊字符定义字段名称,例如 ^
- ios - 具有清晰背景和彩色 contentView 的 UITableViewCell
- docker - 复制 。. 在 dockerfile
- javascript - Web Audio API 将单声道拆分为立体声
- mysql - MySQL INSERT with SELECT UNION 给出语法错误
- node.js - BigQuery:NodeJS 客户端库时间戳错误
- python - 如何恢复并执行两个独立的 TensorFlow 模型?
- javascript - 续集更新或创建包含的关联
- excel - VBA #VALUE!”使用函数时出错
- javascript - 将两个输入字段初始化为具有不同 html 类的日期选择器