How to commit a git repo into a git repo (not submodule)

我与影子孤独终老i 提交于 2020-01-04 02:27:09

问题


When I try to add and commit a git repository into another git repository, git helpfully makes it into a submodule. What if I want to track and commit changes to that nested repository in the outer repo? I.e. I want the outer repository to track all the files in the nested repo's working tree as well as its .git directory.

The use case here is that I want to maintain a git repository of my whole "projects" directory (many of which use git or another VCS) for versioned backups, as well as statistics collection. Going to a particular commit in the outer repo should show me the complete state of all projects at that time, including e.g. commits that may later have been rebased into oblivion.


回答1:


Not possible.

After researching this further I found the answer is unfortunately that it is not possible. Git is hardcoded to ignore nested git repositories and cannot be told to index them.

The most common git-like suggestion for the backup use case is bup, which seems fine for that use case alone, but can't seem to do all that git can stats-wise.



来源:https://stackoverflow.com/questions/18736713/how-to-commit-a-git-repo-into-a-git-repo-not-submodule

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!