![]() To update your submodule to a specific branch or tag, simply switch to that branch or tag: git switch specific-branch Now, all we want to do is to change the state of the submodule repo. no branch or tag points to that specific commit. ![]() The “HEAD detached” state basically means that your current state of the submodule “has no name”, i.e. If you have a terminal that shows the branches, it’ll most likely show you a hash instead of a name: ~/the-repo/shared $Īnd the output will be something like: * (HEAD detached at 569d7ce) master Change your directory to this branch: cd shared Let’s assume your submodule is under the path shared. a specific tag on the other repo or a specific branch, or even a specific commit. Now let’s assume you want to upgrade (or downgrade) your submodule state to a specific version, e.g. git commit -m "Update submodule to use Python 3.9" Updating Submodule to a Specific Version If the submodule is not separately versioned, try to mention why the submodule was updated. It’s also important to have a meaningful commit message for it. To review the commits that were added to the submodule, do: git diff -submoduleĪfter the code was tested against the new submodule version, commit the submodule by staging its path: git add git commit -m "Update submodule to version XXX" ![]() To update your submodule to its latest version, do: git submodule update As an upgrade to the latest version of your dependency might break your code, so does an update to the latest version of the submodule. Submodules are like versioned third-party libraries. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |