Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:05:34+00:00 2026-06-13T06:05:34+00:00

A git submodule is currently on a branch, and I’m not sure not if

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:05:36+00:00Added an answer on June 13, 2026 at 6:05 am

    If you’re on a branch foo in 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:

    $ git rev-parse HEAD:mysubmodule
    1b6577014983eb68c56025e6d3b95c8b9b7fc511
    

    … and then compare that to:

    $ cd mysubmodule
    $ git rev-parse HEAD
    4dd9ac74b6dc1d0df8de5029656663bd879a4773
    

    However, you can see this more easily just be looking at the output of git status:

    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #   (commit or discard the untracked or modified content in submodules)
    #
    #   modified:   mysubmodule (new commits)
    

    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 branch foo is in the remote repository. To do that you can do:

    $ cd mysubmodule
    $ git fetch origin
    $ git rev-parse origin/foo
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I add a submodule that does not currently exist, no submodule information is
git status tells me that my branch and the one I started from on
I know that current Git submodules are not supported by AppHarbor (as per this
I'm trying to add a submodule that already existed (different git remote repository). As
I have a Git submodule that I have successfully cloned in to my main
I want to figure out why git submodule foreach command is not working for
git on OSX sees a modified subdir, but won't 'add' it; how can I
Git uses SHA-1 for the user to refer a commit. Subversion (SVN) and Mercurial
Git is implemented as a directed acyclic graph. Children know their parents but not
Currently I am trying to clone this git repo: https://github.com/twilio/OpenVBX into my main repo,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.