Multiple content roots - Git repo only shows for the first one? Follow
I'm currently working on two related Python modules.
In Pycharm (Intel Mac, 2022.2.3), I've created a new project with existing sources for "Module 1".
I then go into: Preferences -> Project -> Project Structure, and click "+ Add Content Root". I select "Module 2" as a second content root. I then click off which directories are source files versus test files, etc.
All of this works perfectly well (Pycharm has no problem finding code), except with regards to Git. The git features in Pycharm only "sees" the git repo for "Module 1". For example, any changes I make in "Module 2", they don't show up in Pycharm under local changes as it doesn't "see" the repo. The repo also doesn't show up in the other git related menu options (like "branches", etc.).
As an alternative, I've tried moving both of my Python modules into a subdirectory, and just adding that one parent directory as the only content root. When I do this, Pycharm can now "see" both Git repos! This seemed like the solution, except with this change Pycharm can no longer resolve local modules (as the parent is now one directory higher).
Is there a way to have Pycharm see the Git repos for multiple content roots?
Please sign in to leave a comment.
Have you mapped both project roots in Preferences | Version Control | Directory Mappings?
Aha! That was the secret sauce I was missing. It's working great now!