![]() ![]() (with 'origin' being the name of the upstream remote repo the submodule has been cloned from.Ī git remote -v inside that submodule will display it. ![]() Git checkout -b branch -track origin/branch Make sure your submodule is actually at the latest of that branch: cd path/to/your/submodule Make sure the parent repo knows that its submodule now tracks a branch: cd /path/to/your/parent/repo Note that if you have an existing submodule which isn't tracking a branch yet, then ( if you have git 1.8.2+): (Git 2.22, Q2 2019, has introduced git submodule set-branch -branch aBranch - ) gitmodules file and gives you the option to update the submodule object to the latest commit of a specified branch before populating it. It is simply adds information about a branch in the. Git submodule add -b is not some magically way to keep everything up to date with a branch. Since you have now updated the commit the submodule object is pointing to, you have to commit the changed submodule object into your Git repository. This can be done in two steps by djacobs7 answer. Instead of populating the content of the submodule to the commit pointed to by the submodule, it replaces that commit with the latest commit on the master branch, THEN it populates the submodule with that commit. The only thing that the -b option buys you is the ability to add a -remote flag to your update as per Vogella's answer: git submodule update -remote The submodule object is still pointing at a specific commit. SubmoduleTestRepo, and you do not need to change the. gitmodules file, but SHA and TAG are not supported! (instead of that, the branch's commit of each module can be tracked and updated using " git add. Note: only branch name is supported in a. So following the same example, it would look like this: Now, all the -b does is add one line in your. It knows where to find the commit because of the information in the. Whenever you do a git submodule update, it will populate your submodule with content from the commit. Git submodule objects are special kinds of Git objects, and they hold the SHA information for a specific commit. Or do git submodule status from a command line. GitHub shows these as "submodule" objects. You have a submodule object (named SubmoduleTestRepo in this example) in your Git repository. You know you have a Git submodule when you have these two things. I'd like to add an answer here that is really just a conglomerate of other answers, but I think it may be more complete. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |