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.
#Git create branch from branch update#
git submodule update actually merges in the new code. Git pull changes which commit their submodule directory points to. Then, another developer who wants to have submodule_directory changed to that tag, does this git pull If you want to move the submodule to a particular tag: cd submodule_directory
![git create branch from branch git create branch from branch](https://i.stack.imgur.com/bBxZh.png)
![git create branch from branch git create branch from branch](https://bobfasr985.weebly.com/uploads/1/2/5/7/125753025/201710978.png)
This is great for a submodule that does not change often, because then everyone on the project can have the submodule at the same commit. This means, when someone else checks out your repository, or pulls your code, and does git submodule update, the submodule is checked out to that particular commit. They are, like you say, just a pointer to a particular commit of the submodule's repository. It's a little confusing to get used to this, but submodules are not on a branch. Note: Git 1.8.2 added the possibility to track branches.