![]() 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. 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. Id like to add an answer here that is really just a conglomerate of other answers, but I think it may be more complete. 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 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 submodules repository. ![]() Its 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. Also, for build systems where you want the build to always track the production branches of various projects, update –remote gives you a convenient way to update the build tree.How can I specify a branch/tag when adding a Git submodule? Normally, this would have to be documented elsewhere, or figured out in some other way. gitmodules and quickly determine that submodule X is tracking branch Y. gitmodules functions more as documentation and convenience. The same thing could be accomplished with something like git foreach “git fetch & git checkout test”. In the actual repository, Git still stores submodules pointed to a particular commit. This functionality is purely a convenience feature in the submodule update command. Now, if you run git submodule update –remote, Git will update the meta-bec submodule to the latest on the test branch. If you want a different branch, simple edit. So, if you already have a Git submodule set up, its a simple matter to run git submodule update –remote to update the submodule to the latest master branch. If you don’t want to fetch, you should use submodule update –remote –no-fetch. In order to ensure a current tracking branch state, update –remote fetches the submodule’s remote repository before calculating the SHA-1. ![]() For example, submodule update –remote –merge will merge upstream submodule changes into the submodules, while submodule update –merge will merge superproject gitlink changes into the submodules. The only change is the source of the target SHA-1. This works for any of the supported update procedures (–checkout, –rebase, etc.). git/config (with .git/config taking precedence). The remote branch used defaults to master, but the branch name may be overridden by setting the submodule.branch option in either. The remote used is branch’s remote (branch.remote), defaulting to origin. Instead of using the superproject’s recorded SHA-1 to update the submodule, use the status of the submodule’s remote tracking branch. This option is only valid for the update command. The “ git submodule update –remote” command is the key to tracking branches with submodules. However, Git submodules are still not as flexible as Google repo, but since submodules are built into Git, the submodule command is a good solution in many cases. This is good news as in many cases, this is exactly the behavior we want. ![]() As of version 1.8.2, Git submodules can now track branches instead of specific commits.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |