質問

I had my project in a 'www' folder.

In 'www/vendor', I cloned other projects from GitHub. I just cloned them, never did anything to make them submodules or subtrees.

Quite often, I worked on these subprojects, contributed upstream, etc. I just had to cd to a directory like 'www/vendor/projectX' and use Git commit there, and it was as if they were independent projects. Then I could go back up to 'www' and make a commit there that would acknowledge the changes in the subprojects into my main project. All great and simple.

Then I moved 'www/vendor' into 'www/php/vendor'. I did git add php and committed the change, and now all my 'www/php/vendor/*' folders are completely empty on the remote server. On my machine, the files are still here but git status says there is nothing to commit.

I don't know but it looks as if all the subprojects had automatically been declared as submodules when I moved them. However I see no trace of it: no .gitmodule, nothing in the modules folder. And this is what I get when I git rm:

$ git rm php/vendor/projectX
error: the following submodule (or one of its nested submodules) uses a .git directory:
php/vendor/projectX

Am I missing something or is this a Git bug? I'd like to go back to the way I worked before, without deleting the .git folders of subprojects or using submodules.

I've been using Git 1.8.4 and 1.8.5.2 in Windows.

役に立ちましたか?

解決

This is the default behavior of Git. It doesn't know what to do with these repos other than declare them submodules.

You could ignore the paths where you keep other Git repos. Especially if you update them with a package/dependency manager and keep the lock file in the root repo.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top