Problem
Changes from a nested Git repository are shown in the Commit tool window in IntelliJ IDEA, even though the entire nested repository folder is listed in the .gitignore file of the root repository. The goal is to ignore the nested repository from the root repository’s perspective and prevent its changes from appearing in the root project’s commit workflow.
Cause
IDE automatically detects all Git repositories within a project directory, including nested repositories. It treats each Git root as a separate version control root. As a result:
The .gitignore file of the root repository cannot affect files tracked by the nested repository.
The IDE shows changes from the nested repo in the Commit tool window because it has independently registered the nested Git repository.
Resolution
To prevent IntelliJ from displaying changes from the nested Git repository in the Commit tool window:
Remove the nested Git repository from IntelliJ’s Version Control roots
-
Go to File → Settings → Version Control (on macOS: IntelliJ IDEA → Preferences → Version Control).
-
In the list of Git roots, locate the entry for the nested repository.
-
Select it and click the - (minus) button to remove it.
-
Click Apply and OK.
This ensures that IntelliJ no longer monitors or displays changes from the nested repository.
Comments
0 comments
Please sign in to leave a comment.