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 6615973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:31:38+00:00 2026-05-25T20:31:38+00:00

I have a git repository which uses a submodule which I’d like to point

  • 0

I have a git repository which uses a submodule which I’d like to point at an annotated tag, but when I do git submodule update new tags don’t get fetched. I can get new tags in the submodule by cd-ing into the submodule and doing a git fetch --tags there, but I’d really like to do all of this from the outside as it’s scripted.

I can’t find anything in the git documentation suggesting a way to get git submodule update to include tags (my git version is 1.7.3.5).

Obviously there is another possibility – to point the submodule at the commit which the tag points to rather than the tag itself, but this doesn’t seem as neat.

Is there a way of getting git submodule update to include tags?

  • 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-05-25T20:31:38+00:00Added an answer on May 25, 2026 at 8:31 pm

    git submodule is implemented as a shell script, so it’s easy to see what it’s doing — it might be at /usr/lib/git-core/git-submodule if you’re using a packaged version. Essentially it just runs git-fetch in the submodule if it the object name (SHA1sum) stored in the main project’s tree doesn’t match the version checked out in the submodule, as Koraktor points out.

    The documentation for git fetch (or man git-fetch while kernel.org is down) says that it should fetch every tag that points to a downloaded object, and the downloaded objects will include every commit that’s an ancestor of every branch that’s fetched. That means it’s surprising to me that you don’t get all the relevant tags on a git submodule update.

    If it’s the case that what you really want is for your script is to try to set a new submodule version and commit that result, I don’t think that git submodule update is the tool that you want – that’s just for making sure that your submodules are at the right version based on what’s currently in the main project’s commit. Instead you should just do something like:

    ( cd my-submodule && \
          git fetch && \
          git fetch --tags && \
          git checkout my-tag )
    git add my-submodule
    git commit -m 'Update the submodule to the "my-tag" version' my-submodule
    

    (I added an extra git fetch --tags just in case your tag isn’t one that points to a downloaded commit.)

    Obviously there is another possibility – to point the submodule at the commit which the tag points to rather than the tag itself, but this doesn’t seem as neat.

    Well, the only thing that’s stored in the main project’s tree for the submodule is just the hash of the commit object, so even if there were a command that said “set my submodule to the tag my-tag in that submodule”, it would end up just storing the hash corresponding to that tag anyway…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a git repository which tracks an svn repository. I cloned it using
I have a Git repository which contains a number of subdirectories. Now I have
We have a git repository which contains source for a few related Java WARs
I have a local git repository which tracks a remote SVN repository via git
I have a git repository with multiple branches. How can I know which branches
I have just one cs file in my repository which Git seems to think
I use currently use Heroku for rails hosting which uses a Git repository for
My company uses Subversion; I prefer Git. I have cloned the Subversion repository on
I have my Git repository which, at the root, has two subdirectories: /finisht /static
I have a Git repository, which for my own reasons I want to manage

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.