I'm not sure how to select a different git repo for each different module I have in my IDEA project, I'm not seeing any option for that, all the git options seem to only relate to one git repo.
Is there a way to differentiate them?, so:
(All inside the same project)
Module A -> repo A
Module B -> repo B
?.
Edit:
Go to Settings/Version Control, there you can configure different VCS roots per directory. So in your case define one VCS root per directory containing the module. You should remove the VCS entry <Project>
and just add entries for individual modules so that it looks something like this:
If you have files modified in several different repositories and hit CTRL+K or otherwise open the commit dialog all changed files will be selected and when you commit your changes a new commit with the same message will be created in all repositories containing the changed files.
If you want to commit files from just a single module either manually select them in the commit dialog or right click your module, go to Git and select Commit Directory.
To push the commits just hit CTRL+SHIFT+K and you should see something like this (notice that both modules are included).
Okay I think I cracked this one for my circumstance anyway... very confusing as there doesn't seem to be specific instructions on how to set this up anywhere. I have a project that houses an Angular-CLI client-side app and a Grails API server-side app.
So if you are trying to set up CVS using GIT for a multi-moduled project and want to use a separate git repository for each module, not the entire project, then....
- Add additional roots by File > Settings > Version Control >
- Click the '+' symbol > browse to the project root and select the module
folder > OK > VCS: select Git > OK
- Repeat step 2 for all other modules
- Once all modules are add that you wish to commit to individual repositories > click the settings OK
- YES, YES, you will immediately be alerted with a 'VCS root mapping' error!!!
- Don't panic. Select the module from the Intellij 'Project/Solution' browser.
- Right-click > select Git > Commit Directory > Unversioned Files click the 'browse' link and select the module directory and click the green '+' icon.
- You will be warned that that the module is already under Git control but go ahead and add it anyway.
- Repeat steps 7-9 for all other modules.
- This will remove the 'VCS root mapping' error.
- Now go to your version control window which should be located a the bottom of the Intellij application window. There should be an unversioned folder > expand > and you will see all modules listed here.
- Add each of the modules by clicking the '+' button... again???!!! :-)
- Right-click the default tree and select 'commit and push'.
- This will commit all the modules to the local VCS Git
- Once the commit has completed a dialogue 'Push Commits' will appear where you will see that each module has an open to add your remote repo url for each module!!!!
- Yey!!!!
Hope this is helpful for all :-)