yadhu
yadhu

Reputation: 95

How to manage submodules in forked repositories without causing conflicts in pull requests?

I am working with two repositories: Library and Project1. Here's my current setup:

  1. Repositories:

    • I have forked both Library and Project1 to create Library.myfork and Project1.myfork.
    • Project1.myfork is added as a submodule inside the examples/ folder of Library.myfork.
  2. Folder Structure: My current structure in Library.myfork looks like this:

    Library.myfork/
    ├── examples/
    │   └── Project1.myfork/ (submodule pointing to Project1.myfork)
    ├── src/
    ├── README.md
    └── ...
    
  3. Problem:

    • When I push changes to Library.myfork, the commit includes both the examples/Project1.myfork submodule reference and its changes.
    • If I raise a pull request (PR) from Library.myfork to the original Library repository, this PR causes conflicts because other developers may have added their own forks of Project1 as submodules (e.g., Project1.theirfork).
    • This creates a conflict in the submodule pointer and related files.
  4. What I've Tried:

    • Adding examples/Project1 to .gitignore, but it doesn't solve the issue for submodule references.
    • Searching for alternatives to submodules like subtrees, but I'm not sure how that will impact PRs to the main Library repository.

What's the best way to manage this setup without causing conflicts in pull requests? Specifically:

Upvotes: 1

Views: 46

Answers (0)

Related Questions