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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:03:04+00:00 2026-05-13T19:03:04+00:00

I have the following project setup: Solution A Project 1 (a lightweight component) Project

  • 0

I have the following project setup:

  • Solution A
    • Project 1 (a lightweight component)
    • Project 2 (contains a lot of files and depends on Project 1)

Solution A is a single git repository. Then I created another solution and found that I could reuse and even update the functionality of Project 1. So my second solution would probably look like this:

  • Solution B
    • Project 1 (must be shared!)
    • Project 3 (depends on Project 1).

Now I want Project 1 to become a shared component. That is, every time I change the source code of Project 1 from either solution (A or B), I need the other one to update accordingly.

Maybe this has something to do the the submodule feature of git. However, the only way I was able to use it is to specify the whole Solution A as a submodule for Solution B. This is not really what I want ideally due to enormous size of Solution A. I only need a tiny part of it to be a submodule.

I know that it’s possible in svn and works exactly as I’ve described: you specify a directory within an external repository in the svn:externals property.

Any tips on that? Or maybe, 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-13T19:03:05+00:00Added an answer on May 13, 2026 at 7:03 pm

    This is definitely related to submodules (see the nature of submodules)

    In your case, the ideal solution would be to extract Project1 from SolutionA Git repo:
    See How to extract a git subdirectory and make a submodule out of it?.

    But that involves rewriting SolutionA history, which is a problem if you have already published it and if some people are pulling from it.

    Using filter-branch for the extraction process.

    To rewrite the repository to look as if Project1/ had been its project root, and discard all other history:

    git filter-branch --subdirectory-filter Project1 -- --all
    

    Thus you can, e.g., turn a library subdirectory into a repository of its own. Note the -- that separates filter-branch options from revision options, and the --all to rewrite all branches and tags.

    Then declare Project1 as a submodule in SolutionB:

    cd SolutionB
    git submodule add /path/to/Project1 Project1
    

    NOTE: Do not use local URLs here if you plan to publish your SolutionB!

    git commit -m "Add submodules Project1"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.