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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:24:48+00:00 2026-05-29T09:24:48+00:00

We are moving our (huge) project to git and we are thinking about using

  • 0

We are moving our (huge) project to git and we are thinking about using submodules. Our plan is to have three different heads in the superproject:

release, stable, latest

The project leads will handle the release and stable branches. They will move the submodules as required.

The issue is the "latest" head. We would like the superproject "latest" head to track the master branches of all the submodules (automatically). And also it would be great if it would show the history of all commits to the submodule.

I have looked at gitslave, but it is not quite what we want. Any suggestions?

  • 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-29T09:24:50+00:00Added an answer on May 29, 2026 at 9:24 am

    Edit (2020.12.28): GitHub change default master branch to main branch since October 2020. See https://github.com/github/renaming
    This answer below still reflect the old naming convention.


    Update March 2013

    Git 1.8.2 added the possibility to track branches.

    "git submodule" started learning a new mode to integrate with the tip of the remote branch (as opposed to integrating with the commit recorded in the superproject’s gitlink).

    # add submodule to track master branch
    git submodule add -b master [URL to Git repo];
    
    # update your submodule
    git submodule update --remote 
    

    If you had a submodule already present you now wish would track a branch, see "how to make an existing submodule track a branch".

    Also see Vogella’s tutorial on submodules for general information on submodules.

    Note:

    git submodule add -b . [URL to Git repo];
                        ^^^
    

    See git submodule man page:

    A special value of . is used to indicate that the name of the branch in the submodule should be the same name as the current branch in the current repository.


    See commit b928922727d6691a3bdc28160f93f25712c565f6:

    submodule add: If --branch is given, record it in .gitmodules

    Signed-off-by: W. Trevor King

    This allows you to easily record a submodule.<name>.branch option in .gitmodules when you add a new submodule. With this patch,

    $ git submodule add -b <branch> <repository> [<path>]
    $ git config -f .gitmodules submodule.<path>.branch <branch>
    

    reduces to

    $ git submodule add -b <branch> <repository> [<path>]
    

    This means that future calls to

    $ git submodule update --remote ...
    

    will get updates from the same branch that you used to initialize the submodule, which is usually what you want.


    Original answer (February 2012):

    A submodule is a single commit referenced by a parent repo.
    Since it is a Git repo on its own, the "history of all commits" is accessible through a git log within that submodule.

    So for a parent to track automatically the latest commit of a given branch of a submodule, it would need to:

    • cd in the submodule
    • git fetch/pull to make sure it has the latest commits on the right branch
    • cd back in the parent repo
    • add and commit in order to record the new commit of the submodule.

    gitslave (that you already looked at) seems to be the best fit, including for the commit operation.

    It is a little annoying to make changes to the submodule due to the requirement to check out onto the correct submodule branch, make the change, commit, and then go into the superproject and commit the commit (or at least record the new location of the submodule).

    Other alternatives are detailed here.

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

Sidebar

Related Questions

We are thinking about moving our tests from MSTest to XUnit. Is there any
We are moving our database server to a bigger box. I have several databases
We have a common problem of moving our development SQL 2005 database onto shared
While evaluating the advantages and disadvantages of moving our Subversion-based repository over to Git,
The following is beginning to become a huge problem for us. We have about
We're using a simple File.Copy in C# for moving our database backups to extra
We're thinking about moving over to Mono and I see that Dapper works with
We will be moving our Application in production . For this , We have
So we're gradually moving all our projects across into SVN, from CVS. One project
Our team is currently in the process of moving from SVN to Git. We

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.