Reputation: 878
We created a repository for a basic setup that we can use for new projects. This basic setup is 'work-in-progress', so development on this is ongoing. When there is a new project, we'd like to take the basic setup and use it. The new projects are modules inside the basic setup.
Since the basic setup is being developed, we'd like to push updates to the other repositories. How can we do this with Git?
I read something on Gitslave. Is this good? http://gitslave.sourceforge.net/
Upvotes: 2
Views: 1959
Reputation: 31471
Gitslave is used when you want to run the same command on multiple repos. The only applicability in this case would be if you created a superproject (potentially out of basic repo, possibly another repo) and had all of the project repos as children. You could then, in one command, add a remote in all of the slave repos pointing at the basic repo, check out the basic-branch in all slave repos, then pull the changes into each slave repo, and finally merge/rebase the basic-branch onto the project branch (master or whatever). Once you have resolved any conflicts, you can then push each project repo out.
This is the inverse of pushing the changes into the other repositories, but probably much more useful since you can then automate the merge process as well.
Note another approach which is more consistent of your original desire would be to add the "all" target for push which would push the basic-branch to multiple repos in the same command. http://jeetworks.org/node/22
However, please note that you must have a "basic-branch" concept under all circumstances to have a sane branching strategy. Specifically, the project branch must be branched from basic-branch so that updates to basic-branch can be merged or rebased in.
Still another option would be to have one repo to rule them all, and create one branch per project. You would then need to write some automation to merge your changes to basic-branch into all other appropriate branches. Depending on your needs, security, or how far the projects drift from each other, or how much project-specific cruft there is, this may or may not make sense.
Upvotes: 2
Reputation: 1328982
I don't think submodules or slaves are appropriate here:
You don't want a sub-directory with the content of another repo, you want to merge the (updated) content of a repo with a basic project structure.
It would be easier if each project repos add that 'basic
' repo as a remote (git remote add basic /path/to/basic/repo
), and pull that basic
repo in a local branch (named for instance 'basic-br'), and then merge said branch in their current branch.
That way, they can fetch or pull regularly the basic
repo, and merge if needed the basic-br
branch.
Upvotes: 1