Multiple Git repos for one solution

Viewed 1576

I'm working on solutions split on multiple Git repos.

Every project has its own Git repository and a tool builds a workspace with the required ones and generates a solution file. That's the workframe of my company.

Eg:

<root>
├─── solution.sln (generated by checkout tool)
├─── project group 1
│       ├─── project 1.1
|       |       ├─── .git
|       |       └─── <project files>
│       └─── project 1.2
|               ├─── .git
|               └─── <project files>
└─── project group 2
        ├─── project 2.1
        |       ├─── .git
        |       └─── <project files>
        └─── project 2.2
                ├─── .git
                └─── <project files>

Note that there is no repo at the root (projects are not submodules).

Visual Studio seems to be able to connect to only one repo in the Team Explorer view. However, I sometimes edit files from multiple projects.

I'd like to have (at least) an agregated view of the changes for the current solution (ie across all the repos). If possible, I'd like to be able to see the diffs from that view.

JetBrain's Rider does this but for now, I'd prefer to be able to stick Visual Studio.

Is there any extension doing this?

2 Answers

I wrote a command-line tool to manage multiple repos. You can see the status of all repos, including the edit status, the relation to remote branch, etc. It also batch executes commands from any working directory.

You can also group the repos. For your project structure, you can run

gita add -a <root>

which will automatically generate hierarchical groups:

  • root: containing all repos
  • root-project-group-1: repo 1.1 and 1.2
  • root-project-group-2: repo 2.1 and 2.2

Then gita ll root, gita ll root-project-group-1, etc will display the relevant information. gita <command> root will batch run the command on repos in the root group. You can surely run command on specified repos from any working directory too.

There are other functionalities such as setting context, defining custom commands, etc. Installation is pip3 install -U gita. You can find more information on github.

enter image description here

Related