我决定默认限制存储库树中的可见范围,以便为精美的东西创建公共文件夹。现在因为有很多子存储库,我得到了一个痛苦的提交或一些聪明的想法。我不确定最好的方法 - 我考虑过使用 find 遍历存储库,然后对每个存储库进行一致的虚拟提交,例如"default perms lower and polished public things to public dir in the root to get the quality up"
但我可能正在重新发明轮子。我不能选择限制子存储库和子模块的数量,因此提交必须从最低的存储库开始,然后如果使用 find 则逐渐向上遍历。
如何处理这种深度 Git repo-repo -tree 更新?
或许相关
Git:如何避免使用子子子子... Git -repos 重复提交? https://stackoverflow.com/questions/10068119/avoid-repetitive-committing-with-sub-sub-sub-git-repos
Git:管理和构建项目的工具? https://stackoverflow.com/questions/11253615/git-a-tool-to-manage-and-to-structure-projects-in-the-version-control
使用更好的工具!
避免黑客攻击,例如$ find . -exec git checkout '{}' \;
然后递归/手动修复权限。有一个名为 Gitslave 的工具,可以更轻松地管理不断扩展的投资组合。有价值的文章here http://sethrobertson.github.com/GitBestPractices/#tool。我还建议您阅读此主题here https://stackoverflow.com/a/11371872/164148,再次出现 SethRobertson 的文章——非常好的读物。
为什么需要 Gitslave?
假设您对存储库进行了更改Happy.git
在结构上像"Works.git > Project.git > Pictures.git > Happy.git"
。然后有人
尝试从您的裸 -git 存储库中提取数据,例如Project.git
。因为
你是个混蛋,你只在Happy.git
。现在你的
朋友会得到一些令人讨厌的错误。一个懒惰的 git 会使用gitslave
-tool.
$ mkdir t1; cd t1; mkdir t2; cd t2; mkdir t3; git init; echo "t3" >t3; git add .; git commit -m "t3"; cd ..; git init; echo "t2" >t2; git add .; git commit -m "t2"; git init; echo "t1" >t1; git add .; git commit -m "t1"; cd ..; cd t1/t2/t3; echo "only here">only; git add .; git commit -m "only"; cd ../..; git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# t2/
$ Look you need to do repetitive work because you did not use Gitslave!
安装 Gitslave 的演练
不幸的是,Gitslave 还没有在 Apt-get 中,所以下载here http://gitslave.sourceforge.net/.
看起来有点像Maven,更多here https://stackoverflow.com/questions/11253615/structure-of-projects-in-version-control-something-like-maven-for-non-java-pro。
您可以通过它来管理您的项目。首先,您指定 super -repo
然后附加从库。
$ git clone http://someGitRepoHere.com/xyz.git super
$ cd super; gits prepare
$ gits attach http://someBareRepo.git yourDirHere
更多线路,例如 153here http://gitslave.git.sourceforge.net/git/gitweb.cgi?p=gitslave/gitslave;a=blob;f=README;h=15cc7076fc876c402ad86bd1e4de7ac6c53ee278;hb=e096b161b5bf7cac1ac537fa749bb27daa2ac999.
当 Gitslave 进入诸如 apt-get 之类的包管理软件时,我将继续这个答案,这样它对人们更有用。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)