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

  • SEARCH
  • Home
  • 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 3720682
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:17:53+00:00 2026-05-19T05:17:53+00:00

I am new to git submodules, and I notice they always refer to specific

  • 0

I am new to git submodules, and I notice they always refer to specific commits.

Is there any way for a superproject’s submodules to always refer to the head of the master branch, so “git submodule update” or “git pull” in the superproject simply does “git pull” on all submodules.

Thanks.

  • 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-19T05:17:54+00:00Added an answer on May 19, 2026 at 5:17 am

    The short answer is no. The idea is that you know for sure a specific commit of the submodule will work with your project, and you don’t want any undefined or unexpected behavior coming in by getting on-the-fly updates. A submodule is directly represented by two things: an entry in .gitmodules, and a gitlink, which is a reference to the SHA1 of the desired commit of the submodule. SHA1, not refname.

    What you’re asking is really for the superproject to have no idea what’s in the submodule. Think about it: different clones of your project could have updated the submodule at different times, and end up with different versions of it there, and then if commits were made in your project, they’d have to record different commits in the submodule. When you merged, you’d have to just ignore what they both say and pull again, probably. The upshot is that your request is avoiding the entire idea of submodules: to know what you have. If you say you’re using “master”, you’d come back two months from now and have no idea what that meant!

    If you want to always get the current master branch, you’re better off doing it yourself. Write a script to pull in all the submodules, and run it now and then, committing the updated versions. (Test first, though!) The point here is that with submodules, for every superproject commit, you must know exactly what version of the subproject you’re using. It’s your choice how often you want to update the version of the submodule; it can be daily if you like.

    The alternative would be to add the directory(ies) for the submodule(s) to your gitignore, and write a quick little script to update them (and probably one to clone them too). This would cost you the ability to know what version you had at some point in the past.

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

Sidebar

Related Questions

Is there a way to create a new git repository from an existing one,
Possible Duplicate: Is there any way to clone a git repository’s sub-directory only? clone
I'm quite new to Git: I come from SVN and there I found really
We are using submodules and we are new to git. We often see merge
Is there some easy way to rename a git submodule directory (other than going
Setting up new git installations. On one Windows laptop, I'm running (under cygwin): git
I'm trying to move an existing project into a new git repo So far
I am new to git. I am wondering whether the following scenario is supported,
I am new to git, and have a subversion repository that I want to
I am new to Git and I seem to have one branch too many

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.