How to push changes to multiple Git Repos?

I am trying to push changes I make on files to 2 separate git repos, but have not been able to figure it out yet.

I have 2 separate git repos, lets call them SITE repo and FRAMEWORK repo.
The SITE repo is the one that has all of the files for a website, including the framework files its using.
The FRAMEWORK repo contains ONLY the framework files.

When I work on any file, I always push to the SITE repo so that that repo will be updated with what ever was done.
But, if I make changes to any of the framework file, I want to push those also to the FRAMEWORK repo.

And this is what I don’t know how to do.
I tried setting up a separate remote and branch for the FRAMEWORK repo and to push things to it, but, the framework folder doesn’t have changes anymore since I already added and pushed to the SITE repo, plus, all changes I make in the main SITE/master branch are not copied over to the FRAMEWORK/master branch.

So I am not sure how to handle this, maybe I should create a separate workspace for the FRAMEWORK repo, and just pull changes from SITE and push to FRAMEWORK?

Any tips would be very helpful!

This would basically be the same as if I would have my own git project that I work on, but I would want to pull and push to another git repo to contribute to it, say for example a plugin of some sort, and I want to contribute some updates to it.

There are two approaches to solving this problem.

The framework and site live in the same repo using the MONO-REPO pattern. This pattern is probably best served with an ecosystem of reusable libraries rather than independent sites.

The other approach is to publish the framework packages and install them using a dependency management system in the site project. The site project / repo shouldn’t be physically including the framework. The site repo should only be using the framework indirectly through a dependency management system that can install and manage external dependencies.

Having a physical copy of the framework inside the site repo is an anti-pattern best avoided by using proper dependency management techniques and continuous integration/delivery.

The type of dependency management one would be able to recommend is based on the languages you are using. Most languages these days have a dependency management system built into them or provided as an external option.

Also from an architectural perspective something from SITE shouldn’t need to be pushed to FRAMEWORK. The Framework shouldn’t have awareness of a site that uses it. The framework should live completely independent of the site that uses That is poor architecture that should be corrected not facilitated with even more architectural mistakes and anti-patterns that will inevitably turn into a brittle, difficult to maintain disaster.

Thanks for this!

I can’t say I understand everything, but I understand the main points I believe.
So I will need to do more research and understand how to update my structure accordingly to make this more possible.

Thanks again.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.