- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我怎样才能做 git submodule absorbgitdirs
的反向操作? ? IE。移动子模块的 .git
信息出superproject/.git/modules/<module>
然后回到 superproject/path/to/<module>/.git
目录?
我还想要<module>
成为 superproject
的子模块,我只是不想<module>
的 .git
superproject
中的目录信息的 .git/modules
目录。
最佳答案
请注意,这将使 superproject/path/to/<module>/
嵌套 Git 存储库,其 SHA1 仍将由父项目记录。
要保持完全相同的状态,您可以复制superproject/.git/modules/<module>
并重命名为 superproject/path/to/<module>
, 并重命名 <module>/<module>
至 <module>/.git
.
然后你可以使用 git submodule deinit
删除子模块:
mv asubmodule asubmodule_tmp
git submodule deinit -f -- a/submodule
rm -rf .git/modules/a/submodule
# if you want to leave it in your working tree
git rm --cached asubmodule
mv asubmodule_tmp asubmodule
I still want to be a submodule of superprojec
然后是 .git
文件夹将在 superproject/.git/modules/<module>
中
submodule absorbgitdirs
不留任何选择:
If a git directory of a submodule is inside the submodule, move the git directory of the submodule into its superprojects
$GIT_DIR/modules
path and then connect the git directory and its working directory by setting thecore.worktree
and adding a.git
file pointing to the git directory embedded in the superprojects git directory.
我没有在 git config
中看到任何可能移动的配置 $GIT_DI R/modules
.
absorbgitdirs
介绍于 commit f6f8586适用于 Git 2.12(2016 年第 4 季度)
Its tests shows它希望使用 GIT_DIR/modules
.
较旧的 Git(before Git 1.7.8,2011 年 10 月)有一个 .git
直接在子模块文件夹中。
如 Jeremiah Rose 所述在 the comments :
Another use case is: if you are using a Docker container to use
git
commands inside a submodule, where the container can't see the superproject and errors out. :(
关于git - "git submodule absorbgitdirs"的对面/反面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44559306/
我怎样才能做 git submodule absorbgitdirs 的反向操作? ? IE。移动子模块的 .git信息出superproject/.git/modules/然后回到 superpro
(注意:有一些类似的问题,但我找不到完全重复的问题) 问题 考虑抛硬币任意次数。在得到 3 个反面之前得到 2 个正面的概率是多少? 代码 为了模拟这一点,我设置了 10000000 次试验,其中 0
我是一名优秀的程序员,十分优秀!