Reputation: 46
I want to update my all git submodule branches to Master.(previously they are in dev branch)
I referred so many links and executed the below commands and i got the below error.
PS C:\Users\Mohan\source\repos\MainProject> cat .gitmodules [submodule "SubProject1"]
path = SubProject1
url = https://[email protected]/TestGitSubModules/SubProject1/_git/SubProject1
branch = dev
[submodule "SubProject2"]
path = SubProject2
url = https://[email protected]/TestGitSubModules/SubProject2/_git/SubProject2
branch = dev
PS C:\Users\Mohan\source\repos\MainProject> git submodule foreach 'git submodule set-branch --default -- ${sm_path}' Entering 'SubProject1'
**error: pathspec 'SubProject1' did not match any file(s) known to git
fatal: run_command returned non-zero status for SubProject1**
can any one help me to get rid of this
Thanks.
Upvotes: 1
Views: 333
Reputation: 935
This should do it:
git submodule foreach --recursive 'git submodule set-branch --default'
Notice the recursion and the omission of a url.
You don't have the remote url in foreach, so you can't give it to track.
Upvotes: 1