I have a project hosted on github with the following structure
github.com/example/allpackages
.
├── .git
└── packages
├── example-1
├── example-2
└── example-3
On each push to github I would like for the contents of each package to pushed to a repo the corresponds to the repo name e.g.
github.com/example/example1
.
├── .git
└── example1
github.com/example/example2
.
├── .git
└── example2
etc.
Any one have any ideas on how to automate this? Someone mentioned using Travis-CI for this task, but I couldn't find any specifics on how that might work.
My ideal solution:
- Would be complete automated -- meaning the update would not be triggered by the pushing computer, but rather github or an external service.
- Migrate the history from "allpackages" to the corresponding subrepos on update
Any guidance on where to start researching would be greatly appreciated. Thanks in advance!
Edit:
@VonC suggested using submodules, and making commits using git submodule foreach --recursive
Pros:
- Dry - the code for each submodule lives in one place.
- Able to track changes to submodules in parent.
- Using
git submodule foreach --recursive
using an alias allows for a single commit to multiple submodules
Cons:
- Viewing the changes made to the submodules is not immediately clear. One must dig into the submodule to see what changes had been made.
- Using
git submodule foreach --recursive
is cumbersome, and not as elegant to work with as a regular commit.
For this particular use case. The "package" repos e.g. github.com/example/example1
will be read only in a sense. I will not be pushing to them directly. They will only receive updates when allpackages
is updated. The only reason that they need to be created, is because the package manager that utilizes them requires separated repos for each package.