Multiple git repositories

Hi!

I currently have a repository within another. There is the main repository, which is a PhpStorm project, and a subfolder which is a separate repository. The subfolder is not to be committed into the main repository, therefore I added the foldername to .gitignore. This prevents PhpStorm from detecting changes in the sub-repository, and thus makes me unable to commit/push them. The main-repository works perfectly.

Is there a workflow that will allow me to work in such a manner? I could remove the entry in .gitignore and push to separate remotes, but I am worried there will be mix-ups.

best regards,

Henning Kvinnesland,
Norway

2
8 comments

Hi Henning,

Just add the folder containing the sub-repository as a VCS root in Settings -> Version Control.

Several operations in IDEA are able to handle multiple Git repositories at once. These are, for instance, Commit, Update Project and Push Active Branches. Some of the Git operations, though, need to be run separately on each repository.

In JetBrains we have a similar situation, where one repository is located under another. On the screenshot you may see the VCS root for our case.

vcs_roots.png

11
Avatar
Henning Kvinnesland

Works perfectly! :D

0

Hi!

What can I do for autodetect all Git repositories in opened folder?
In some projects I have many Git repositories and it is difficult to add every reposytory by File - Settings - Version Control - Add ...

0

Hi Roma,

actually, we have this auto-detection implemented.
If you open Settings | Version Control, at the bottom of the table it should list the repositories which were found within the project, but not yet registered in the table. Do you have them there?

0

Yes, I have the list of not added repositories.
But maybe I can do something for auto add all repositories to project, without click to "Add root" of every repository?

0

No, currenty it is not possible to add all roots with a single click.
You may take a look and vote for the following related issues: http://youtrack.jetbrains.com/issue/IDEA-89259, http://youtrack.jetbrains.com/issue/IDEA-81270.

Btw, you don't need to set up roots _often_: this is usually done only once for the project, isn't it?

0

My situation is opposite : i dont want PhpStorm's IDE to manage upperlevel GIT repo, but only subfolder's GIT repo. It does commit to subfolder fine, but then it wants to commit again to topfolder's git repo, which i never want to.
I'm looking for a way to inactivate PhpStorm's access to topfolder's GIT repo : https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002593980-IDE-should-only-manage-subfolder-GIT-How-to-deactivate-top-folder-GIT-management-?page=1

0

This works great. thank you.

 

However, the "pull requests" tab in the git toolbox window only shows up pull requests from one repository (the first one that was added) and not from all of them.

Is there a way to view all pull requests or at least be able to open multiple pull requests tab per each repo?

 

Thanks

1

Please sign in to leave a comment.