Is it possible to manage multiple repositories coherently?

拈花ヽ惹草 提交于 2019-11-30 19:04:09

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.

Cezary Baginski

You can use the repo tool: https://gerrit.googlesource.com/git-repo/

  • set the same branch on multiple projects
  • view state of multiple repositories (branches, unmerged commits) with one command
  • manage a set of repositories (clone, sync, etc) with manifest files
  • lots of other cool stuff

Also, take a look at: http://fabioz.github.io/mu-repo/ -- it's a tool such as mr and repo as I couldn't get those to work as I needed :)

Some notes:

  • it's done in Python (so, works well in any OS where Python runs: Linux, Win, Mac...)

  • besides running common git operations against many repos at once also provides workflows to:

    • clone multiple repositories
    • open urls from repos (so, it's possible to do create pull requests for multiple repos at once).
    • diff changes on multiple repos at once with winmerge or meld
    • execute non-git commands

Just as an idea. I haven't tried this by myself, but I came across this feature some time ago. Try to add all the wanted repositories as submodule to a new "root" repository and use the following command

git submodule foreach --recursive <command>

You may consult the help for this and how to deal with submodules. You can use whatever command you want. git and non-git commands.

The Android repo tool manages the creation of feature branches across multiple repositories. However the repo upload command can only publish to Gerrit code review.

If you use an ordinary Git repository manager like GitHub or GitLab, repo upload will not work; you need the nonexistent repo push command. I implemented repo push in the Wave Computing fork of repo. We use it in production.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!