A git submodule is currently on a branch, and I’m not sure not if it’s at the tip. How do I get the commit ID of the branch’s tip so that I can pull up the submodule if necessary?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re on a branch
fooin the submodule, then by definition you’re at the tip of that branch. Perhaps what you want is to find out what commit the submodule should be at, according to the version committed in the “supermodule”? To do that you can do:… and then compare that to:
However, you can see this more easily just be looking at the output of
git status:The “new commits” indicates that your submodule is behind the committed version, and should be updated with
git submodule update mysubmodule.You can also see this from the output of
git submodule, where the line corresponding to your submodule will begin with+if the submodule needs to be updated.Another interpretation of your question is that your submodule is on the branch
foo, but you want to know where the tip of the branchfoois in the remote repository. To do that you can do: