I have git repository which has a sub module from the same repository but different branch i added it using
git worktree add -b develop ../src
and when i type: git worktree list
i get this:
but when i try to pull nothing changes in src folder.
i've added in .git/config:
[branch "develop"]
remote = origin
merge = refs/heads/develop
still nothing changed.
Is there a command that when cloning the repository will pull automatically the sub-module with ?
From what I documented in "What goes wrong when using git worktree with git submodules", if you are using a Git 2.26+, a git checkout --recurse-submodules
(documented here) done inside your new worktree should work with submodules.
Make sure to add your worktree in a patch which is not in the current local cloned repository.