Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to manage multiple repositories coherently?

I have a collection of git repositories that are independently versioned but related to one another. For example, when adding a feature I may have to add functionality to a shared library, and then extend an application or service to take advantage of that functionality.

Currently, I would have to create a branch on each of the repositories that I touch while working on that feature. What I would like to do, however, is to simplify the process by branching and merging those multiple repositories at once (to reduce the likelihood of forgetting to branch, or committing/merging in one repository but not another).

Is there a simple way to branch and merge multiple repositories at once, or is this a task better suited for a collection of helper scripts? If the latter, are there any scripts available that already accomplish this?

like image 902
Justin ᚅᚔᚈᚄᚒᚔ Avatar asked Feb 03 '12 21:02

Justin ᚅᚔᚈᚄᚒᚔ


People also ask

Can you have multiple repositories?

With Git, using multiple repositories is the only way to work efficiently. This enables each team to work independently, and do their work faster. You can also make sure that developers only have access to the repositories they need access to (thus making Git more secure.)

Can you push to multiple repositories?

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync. Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

How do I use multiple repositories in Jenkins?

create a different repository entry for each repository you need to checkout (main project or dependancy project. for each project, in the "advanced" menu (the second "advanced" menu, there are two buttons labeled "advanced" for each repository), find the "Local subdirectory for repo (optional)" textfield.


1 Answers

There isn't a built-in way to deal with multiple repositories at once, and if you think about the distributed nature of git, there really isn't anything but social convention that can define that. (Consider, what if someone pulls from you in one repository, but another remote for the second - can you have this coherence?)

You might find a tool like mr, which works with multiple repositories at the same time, helpful.

If you really have things that are tied that tightly, though, I would advise you to put them into one repository. That way you can't forget any of the steps, because they happen in one atomic operation.

If your code isn't actually that tightly tied together, though, then give up the "must branch at exactly the same time" notion and you will be happier.

like image 150
Daniel Pittman Avatar answered Oct 10 '22 16:10

Daniel Pittman