Roman Dornhof
Roman Dornhof

Reputation: 199

Git submodule add to an existing non empty folder

I'm trying to add a git repo with our corporate wp plugins to a wp project as a submodule:

git submodule add [email protected]:company/our-wp-plugins.git htdocs/wp-content/plugins/

Firstly I got this error:

'htdocs/wp-content/plugins' already exists in the index

So I removed it from the index with git rm -r --cached htdocs/wp-content/plugins, but this time I got another error:

'htdocs/wp-content/plugins' already exists and is not a valid git repo

Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?

Upvotes: 0

Views: 1583

Answers (1)

VonC
VonC

Reputation: 1329682

Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?

No, a submodule will create its own root folder (which is actually a gitlink, a special entry in the index of the parent repo)

Make sure the .gitmodules has not already registered that path, and check the content of .git/modules folder, before attempting another git submodule add.

Upvotes: 3

Related Questions