문제

I have some Xcode project I'm trying to clone from GitHub using git, and it has external submodules as well. Whenever I try to clone, it keeps putting these external submodules as well as every folder in the project on "(no branch)" instead of master. This is what I'm doing in Terminal:

git clone git@github.com:******.git
cd ******
git submodule update --init
cd External/******
git submodule update --init
cd External/******
git submodule update --init

If I cd into any folder and do git branch, I get this:

git branch
* (no branch)
master

Is there a way I can force git clone to use the master branch everywhere?

도움이 되었습니까?

해결책

This requires git 1.8.2 or later (March 2013)

It depends on how those submodules are declared in the .gitmodules:

See "git submodule tracking latest"

That would allow you to follow the master branch.
Update your current .gitmodules with a:

git config -f .gitmodules submodule.<path>.branch master
git submodule update --remote --recursive

Note that the submodule still won't be on any branch. Simply their SHA1 would be the one of origin/master.
You would still need to checkout master for each of them.

git submodule foreach --recursive git checkout master
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top