Reputation: 1112
We are considering introducing Git into our workflow. At the moment, we have a general PHP template that we copy paste for each new project. The copied template then gets extended with modules specific to the project. Sometimes it happens that while working in a project, we do some adjustments that would be good for the template, we then copy paste these back into the master template.
If we were to introduce Git, our master template would be the main repository. Every new project would be a clone of the template (so bugfixes in the template can be pulled down). However, how would you manage pushing changes back to the master template? We can't push all files, because then our master template would be littered with project specific modules.
Is there a way to only push specific commits to a remote repository?
Upvotes: 2
Views: 110
Reputation: 2182
I would not push changes from projects which use the master template. Instead, I would create own project for the master template and this project would be only for bugfixes and new features for the master template. Only this project could push changes to the master template repository and other projects can only pull.
Upvotes: 0
Reputation: 52055
You could interactively git rebase
the changes that should be applied to the templates onto the upstream repository. For this, the developer doing it would create a temporary branch from the upstream's master, then rebase the desired changes onto it, and push that branch back (if he has push access; otherwise the person who "owns" the template repo has to pull from them or otherwise apply the changes).
See also: Pro Git Chapter on Rebasing
Upvotes: 2