1

I have created a php project. In this project under vendor/ I have included using composer some other 3rd party modules. I think they came with a .git folder.

Finally I decided to add my code under git. But now I have problems. Some of this 3rd party modules came with a .git folder some without ( idk the reason ). why this happen any clue ?

In my root folder I have nothing in .gitmodules.

When I do git status I get:

# modified: vendor/somemodule (modified content)

What should I do in this case, what's the best way to handle this. I want to be able to still be updated about the changes in those libraries and also keep a track of those modules in my repository ( beanstalk ) which when merged to master branch will upload to live server.

Any ideas, any links to read would be helpful. I don't even know if this are submodules or not yet.

an image with my vendor:

enter image description here

Thanks.

Marius.C
  • 700
  • 6
  • 14
  • Check first if those are submodule: http://stackoverflow.com/a/24242793/6309 – VonC Jun 26 '14 at 08:43
  • If I do `git ls-tree HEAD` in the root don't get any 160000 if I enter in a directory in vendor some have 160000 some don't have – Marius.C Jun 26 '14 at 09:21
  • @VonC I've updated my post with an image. should I map them in .gitmodule all of them. What would you do in this case :) ? – Marius.C Jun 26 '14 at 09:32
  • I would check for the exact nature of the changes in the submodule, to see if those changes can be ignored or should be pushed to their upstream repo: `cd vendor/somemodule ; git status` – VonC Jun 26 '14 at 09:45
  • I think can be ignored the changes. but when trying to deploy I get an error saying that a module from there has no mapping in .gitmodules and second I don't like the way they are, some submodules some not. – Marius.C Jun 26 '14 at 09:56
  • It seams there's a problem with composer: https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md saw it too late. Thanks alot for your help! – Marius.C Jun 26 '14 at 10:01

1 Answers1

1

The OP Marius.C confirms:

When I do git status I get:

# modified: vendor/somemodule (modified content)

That does mean vendor/somemodule is a submodule (see "Strange Icon and Entry after corrupt commit").

But the root issue seems to be an issue with composer, as commented by the OP.

Should I commit the dependencies in my vendor directory?

The general recommendation is no. The vendor directory (or wherever your dependencies are installed) should be added to .gitignore/svn:ignore/etc.

Considering the changes seen so far seem to be not important, ignoring vendor should be the best approach.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250