![]() ![]() # since you did not push you submodule chage commit to remote. # from remote master which is 1 commit behind your local branch # since at this point you just asked git to update your submodule # as you see you are DETACHED and you are lucky if you found out now $ git status # will show again that (submodule has new commits) Submodule path 'path/to/submodule': checked out 'commit-hash' Nothing to commit, working directory clean # As normally you would commit new commit hash to your parent repo Modified: path/to/submodule (new commits) ![]() $ git commit -m"Your modification" # Let's say you forgot to push it to remote. update = checkout $ cd # and make modification to your submodule ![]() In the common cases, you already have fixed by now your DETACHED HEAD since it was related to one of the configuration issues above.įixing DETACHED HEAD when. # is here path releative to parent repo root First you want to make sure that your submodule has the branch checked out which you want to be tracked.If you haven't added your existing submodule like this you can easily fix that:.you tell git to update your submodule from remote.you tell git to perform rebase or merge instead of checkout.First you tell git to track your remote.Solution: Make your submodule track its remote branch by adding new submodules with the following two commands. Cause: Your parent repo is not configured to track submodules branch.# If no is specified, then it defaults to the current branch. # if the master branch already exists locally: Solution: Make sure your submodule is tracking the correct branch Cause: Your submodule is not tracking correct branch (default master).I believe that I am correct in stating, that we all have been there at some point where our submodule's HEAD gets detached. This is a common case when one does not use submodules too often or has just started with submodules. So back to the question: Why does it happen?Īfter pulling changes from server, many times my submodule head gets detached from master branch. Personally I hate answers here which direct to external links which may stop working over time and check my answer here (Unless question is duplicate) - directing to question which does cover subject between the lines of other subject, but overall equals: "I'm not answering, read the documentation." Submodule.branch specify remote branch to be tracked - default master Submodule.update is what you want to change, see the docs - default checkout ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |