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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:03:24+00:00 2026-05-26T20:03:24+00:00

I’m organizing our product’s source code into a bunch of different Git repositories. (And

  • 0

I’m organizing our product’s source code into a bunch of different Git repositories. (And I’m new to Git). Some of them will use other repositories on the same server via submodules.

As I understand it, a submodule in Git is a pointer to a specific commit in another repository and is defined by:

  • URL of the remote submodule (e.g. git://foo.com/git/lib.git)
  • A subdirectory to clone the submodule’s repository into (e.g. include/foo)
  • The commit ID we are referencing

The problem is that a URL is being stored in the repository as part of the commit when the submodule was added. What happens if the URL changes? The parent repository might have hundreds of commits – all with a submodule referring to the old URL.

For example, suppose I store repositories Super and Sub in git://PrivateCompanyServer/repositories/*. Super refers to Sub via its gitmodules file: git://PrivateCompanyServer/repositories/Sub.git. Several developers make hundreds of commits to Super – just about every commit in Super has a snapshot of gitmodules with that URL in it. Several product releases are tagged and all kinds of branches have the URL in gitmodules. Now, suppose PrivateCompanyServer crashes and we move the code to another server. Or we reorganize the directory structure on PrivateCompanyServer. Or whatever. Now we have hundreds of commits in Super referring to the Sub repository at the old URL which doesn’t exist any more. Obviously, the gitmodules file can be corrected at the head of development branch and we can move on there. But there will be all kinds of old commits that we may have to go back to for maintenance reasons and they will all refer to the old URL that won’t work any more. How to handle that?

Obviously this could be solved by rebasing / “rewriting history” so that all gitmodules files in the repository have the new URL but I think this is not an option because just about every commit in Super would get a new commit ID. Everything referencing Super, including “Super-Super” projects using Super as a submodule and local developer repositories would all break – correct?

So what’s the best way to handle this? If you store a collection of repositories on a private company server – some of which refer to other repositories via submodules – what do you do when the server changes names – therefore invalidating the old URLs in gitmodules files?

The only workaround I can think of is to make “lots of branches” from every commit way back in history, just to hold the corrected gitmodules. Seems like that will make a lot of clutter and be cumbersome. Seems like there must be a better way – surely I’m missing something?

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

    As long as you don’t run git submodule sync, the value in .gitmodules won’t affect the submodule path in a given checkout beyond the first time the submodule is initialized (after that, the path for the submodule is kept in the .git/config file).

    So you can just change the path in the checkout once (using git submodule sync on a commit with the updated path), and it will persist without issue.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.