4

I'm putting together a git repo with a bunch of code and have noticed that much of the code I'm wanting to be available in my repo is available from other Git sources. I have done quite a bit of reading on the submodules and subtrees, but not I'm sure which fits my use case the best.

My git repo will have a number of folders, scripts, etc and I want to have the latest code from the remote repositories.

Ideally, if either myself or someone in the community wants to make and change and submit a patch for the code in a folder that is under remote git control, they could work under that folder and submit the patch without effecting my repo.

I also want user to be able to submit patches to my repo for scripts/files without causing a lot of heartache due to submodules/subtrees, etc.

Recommendation on the preferred solution? Submodules, subtrees, or something else?

Here is the example layout.

Folder1

---------SubFolder1.1

Folder2 <= Git Repo =>

Folder3

---------SubFolder3.1 <= Git Repo =>

Darksheer
  • 53
  • 1
  • 4

1 Answers1

2

much of the code I'm wanting to be available in my repo is available from other Git sources
I want to have the latest code from the remote repositories.

Submodule seems the best fit, espacially since a submodule can follow the latest commits from a given branch.
but since you want to submit patches, that means you must first:

  • fork a repository
  • add the fork as a submodule to your project.

That way, you can:

  • create a dedicated branch within that submodule,
  • make new commits
  • push those to your fork
  • make a pull request from there

The only complexity with submodule is to remember that any modification within a submodule means you have to go back to the parent repo, add, commit and push the new SHA1 of the special entry representing your modified submodule.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250