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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:16:13+00:00 2026-05-18T11:16:13+00:00

Suppose I have a library Common that may be used stand-alone, and is used

  • 0

Suppose I have a library Common that may be used stand-alone, and is used by projects P1 and P2, so the tree I want looks like

/Common/.git
        ...
/P1/.git
    .gitmodules  # points to remote server
    Common/
    ...
/P2/.git
    .gitmodules  # points to remote server
    Common/
    ...

When I make a change in /Common, I would like to be able to test it using P1 and P2 before committing. With the usual git submodule command set, I would have to commit from /Common, push to remote, then pull from both /P1/Common and /P2/Common. If the commit breaks something, it cannot be amended because the bad change has already been published. Alternatively, I could git remote add quicktest /Common from /P?/Common to be able to pull without touching the remote server. But this has lots of opportunities for inconsistency and it is dirty to strip broken commits from /P?/Common so that they can be amended in /Common.

I would rather that, during development, the working tree from /Common be used by P1 and P2, but I can’t make /P1/Common a symlink to /Common because git submodule recognizes the symlink as different from a directory. Hardlinking directories is not allowed by most file systems. I can hardlink all the files using

rm -rf /P1/Common
cp -rl /Common /P1/Common

which works quite well until a new file is added to /Common in which case this process needs to be repeated. Is there an elegant way to both

  1. keep git clone --recursive git://remote/P1.git working for the end user, and
  2. allow me to easily test that changes in /Common work with P1 and P2?
  • 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-18T11:16:13+00:00Added an answer on May 18, 2026 at 11:16 am

    I would rather establish an intermediate bare repo where to:

    • push Common new commits
    • pull from for P1/Common and P2/Common

    At least, if commits are amended/removed later, that intermediate repo has never been published outside and you still can reset your P1/Common and P2/Common submodules to that intermediate repo content.


    Update: if you are using git worktree, since Git 2.5 (July 2015, 5 years after writing this answer), make sure to use Git 2.25 (Q1 2020).
    Before that, “git worktree add” internally calls “reset --hard“, which affected submodules.

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

Sidebar

Related Questions

Suppose, I have an opensource project that depends on some library, that must be
Suppose I have taken a video file from iphone library. I want to put
Suppose I have a library that uses exceptions to indicate success or failure. I
Suppose we have a user library project ProjectUserlib that uses an external jar external.jar,
Of course most languages have library functions for this, but suppose I want to
Suppose I have a project ( myproject - a library that builds into a
Suppose I have a C library that I'm linking into a C++ program on
Suppose I have a object structure like this Library 1 ---- 1+ Book 1
Suppose I have a bunch of (very simple) HTML pages, that I want to
Suppose I have a C++ library lib.h that uses classes and templates. Suppose also

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.