从工作树中拉出?

问题描述

我有一个 git 存储库,它有一个来自同一个存储库的子模块,但我使用不同的分支添加了它

git worktree add -b develop ../src

当我输入:git worktree list 我得到这个:

result

但是当我尝试在 src 文件夹中不做任何更改时。

我已经在 .git/config添加了:

[branch "develop"]
    remote = origin
    merge = refs/heads/develop

仍然没有任何变化。

是否有命令在克隆存储库时会自动拉取子模块?

解决方法

根据我在“What goes wrong when using git worktree with git submodules”中记录的内容,如果您使用的是 Git 2.26+,则在新工作树中完成的 git checkout --recurse-submodules (documented here) 应该可以与子模块一起使用。>

确保将您的工作树添加到不在当前本地克隆存储库中的补丁中。