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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:16:01+00:00 2026-05-22T12:16:01+00:00

I have a git project (repo1) including a single submodule (repo2). What I would

  • 0

I have a git project (repo1) including a single submodule (repo2).
What I would like to achieve is to tag my project using an older commit of my submodule (like HEAD – 3).

I tried with a checkout of the submodule to the commit I want, but checkout is wrong since, committing in my project won’t track the proper revision.
I tried resetting my submodule to the commit I want, commit the project, and then pulling the submodule and committing the project, which is also wrong because:

$ git submodule update 
fatal: reference is not a tree: 2c3d1a5936aa9469ecc1442cd4b101e1bbd3aada
Unable to checkout '2c3d1a5936aa9469ecc1442cd4b101e1bbd3aada' in submodule path 'repo2'

What would be the best — as well as nicest — procedure ?


Git submodule head 'reference is not a tree' error gives a beginning of an answer, but it stills links the HEAD of repo2 and not a chosen commit…

Suppose now that the tag is done, how can I tell my repo1 to set repo2 in the proper state for a tag:

 git checkout 0.0.1

According to git submodule update, a simple

 git submodule update

should suffice. It doesn’t checkout my submodule to the specified commit. Why ? Is that a … bug ?

  • 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-22T12:16:01+00:00Added an answer on May 22, 2026 at 12:16 pm

    This question seems really hard, but it is not — way from that.

    The full procedure, starting from a git repo (repo1) with a submodule (repo2).

    $ git clone git@git:myproject.git
    $ cd myproject
    $ git submodule update --init
    

    Now, if I need to tag an old commit of my repo2, here’s what I’d do:

    $ cd repo2
    $ git checkout SOMECOMMITHASHORTAGORELSE
    $ cd ..
    $ git add repo2
    

    adding is important to update the gitlink to repo2’s commit hash

    $ git commit repo2
    $ git tag TAGNUMBER
    $ git push (--tags if you want to push the tag also)
    

    Now, why did the submodule update didn’t work ? The fact is I kept on trying to checkout a commit associated to a tag of repo1

    $ git checkout TAGNUMBER
    $ git submodule update
    

    This didn’t work only because (note to self) I forgot that:

    One shall tag AFTER committing

    So there was no real trick here, simply a little pitfall that may happen again for some of us, hopefully they’ll end up here.

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

Sidebar

Related Questions

I have a project A that is a Git repository. I would like to
I have been using git to keep two copies of my project in sync,
I am using git for windows to manage a local project. I have two
We have a non-standard subversion respository that we would like to convert to Git.
I have forked an SVN project using Git because I needed to add features
I have cloned a svn project repo using git-svn. When I fetch commits, how
I've inherited a project and we are using git. We have a number of
We have a git project which has quite a big history. Specifically, early in
I am not using github. We have git setup on our machine. I created
I have a git repository which tracks an svn repository. I cloned it using

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.