2

I got a project ("myproject"), managed with git. Inside the project there is another project ("a_node_module"), managed with git, too.

myproject
├── .git
├── .gitignore
└── node_modules
    └── a_node_module
        └── .git

The .gitignore file contains:

node_modules

Is this okay or can this cause conflicts? (confusing IDE's, for example).

The reason why I want to do it this way is: it saves a lot of time, while the node module is required in the main project, so I can work on both projects together, and don't need to synchronize the sub project all the time.

Artisan72
  • 3,052
  • 3
  • 23
  • 30

3 Answers3

2

As long as the inner repository is either:

  • a git submodule
  • added in the '.gitignore' of the outer repository

You should not have problems

arainone
  • 1,928
  • 17
  • 28
0

I've been testing it by myself.

  • git itself does not have any problems with it.

With the IDE (PHPStorm) I can open files of both projects, but features like

  • adding new files to git
  • highlighting code changes
  • diff
  • etc.

are only available for the files of the main project.

Artisan72
  • 3,052
  • 3
  • 23
  • 30
-1

Git cannot contain inner project unless its glink or submodule.

It can cause errors.

Add you subproject as submodule to avoid such a collision.

enter image description here

CodeWizard
  • 128,036
  • 21
  • 144
  • 167