简体   繁体   English

如何使用子目录中的仓库正确提交git repo?

[英]How to properly commit a git repo with repos in subdirectories?

I have cloned few github repositories under one directory. 我已经在一个目录下克隆了几个github仓库。 Now I would like to make a repository one level above all of those repositories. 现在,我想使存储库比所有这些存储库高一级。

How can I do this properly ? 如何正确执行此操作? Should I use submodules ? 我应该使用子模块吗?

Short answer: yes, you should use submodules because you've identified that these pieces should evolve separately. 简短的回答:是的,您应该使用子模块,因为您已经确定这些部分应该分开发展。

Probably the easiest way to get it all in place is to create an empty folder, copy the "one directory up" content (anything not in the submodules) into it, commit, then pull in the submodules. 可能最简单的方法是创建一个空文件夹,将“一个目录向上”的内容(任何不在子模块中的内容)复制到其中,提交,然后拉入子模块。 This is because it's really easy to accidentally commit the submodule's code rather than referencing the submodule. 这是因为意外提交子模块的代码而不是引用子模块真的很容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在保留提交历史记录的同时将两个单独的 git 存储库作为两个目录添加到一个存储库中? - How to add two separate git repos into one repo as two directories while preserving commit history? 如何将git repo提交到git仓库(不是子模块) - How to commit a git repo into a git repo (not submodule) 如何将多个存储库克隆到现有存储库中? - How to git clone multiple repos into an existing repo? 如何使用嵌套git repos禁用git repo的子模块功能? - How to disable submodules functionality for git repo with nested git repos? git添加 不添加git repos的一些子目录 - git add . not adding some subdirectories that are git repos 如何将 svn repos 合并到一个具有干净历史记录的 git repo 中? - how to merge svn repos into one git repo with clean history? 如何将父文件夹中的两个 git 回购合并为一个回购? - How to combine two git repos into one repo in parent folder? Git:将不同存储库的两个分支之间的差异作为一次提交提交到另一个存储库 - Git: Push differences between two branches of different repos as a single commit to another repo Git如何制作一个主仓库来跟踪另外两个仓库 - Git How to make a master repo that tracks two other repos 如何将两个 git 存储库作为一个存储库进行管理,但又保持独立? - How to manage two git repos as a single repo, yet stay separate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM