I have three projects (Main
, Submodule
, Test
).
I added the Submodule
project as git submodule
in Main
(which contains a lot of other code) and in Test
(which is empty).
Afterwards, I make changes in the Submodule
project, commit and push them.
When I press the Update Project-Button in my IDE (PhpStorm) inside the Test
project, it fetches all incoming changes of the project as well as the changes made to the Submodule
project.
But when I press the Update Project-Button inside the Main
project, it just fetches the incoming changes to the project but won't get the changes made to the Submodule
project.
git status
also says that there are changes when used in the Test
project but says "up to date" when used in the Submodule
project
Terminal on Test
project:
PS C:\Users\USERNAME\PhpstormProjects\Test> git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: aar-shared (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
PS C:\Users\USERNAME\PhpstormProjects\Test>
Terminal on Main
project:
PS C:\Users\USERNAME\PhpstormProjects\Main> git status
On branch add-shared-repo
Your branch is up to date with 'origin/add-shared-repo'.
nothing to commit, working tree clean
PS C:\Users\USERNAME\PhpstormProjects\Main>
Does anyone have any idea what I'm doing wrong? How can I bring the submodule up to date?
UPDATE:
I just found a difference between my two projects Main
and Test
.
In the Test
project the "Manage Remotes"-Window looks like this:
In the Main
project it looks like this:
I don't know why it wasn't added automatically like in the Test
project but to all the PhpStorm people out there, does anyone know how to add those grouping to the remotes, so like in the first picture "just-a-test" and "aar-shared" above the corresponding remotes?
When I try to add a new remote manually I can just add the name (like origin) and URL.
UPDATE 2: Solved
Just found it:
In Settings > Version Control > Directory Mappings
I needed to add a new entry and select the submodule folder inside the project and set "VCS" to "Git".
Now it's working as expected just like in the Test
project.