4

I have have my own git repository with some subfolders which all belong to my git repository. Now I want to add another subfolder vendor that I cloned from a remote github url.

However, When I try to commit the new folder vendor and its contents,(subfolders, files, etc), git tells me that there are no changes, and I don't know how to add this new subfolder vendor.

user1978011
  • 3,419
  • 25
  • 38
  • Sorry, I was mistaken with my answer. Can you please list all the git commands in sequence (including in which working directory you were) that you used? – user1978011 May 05 '15 at 20:56
  • Generally, [`vendor/` *should not* be versioned](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md). It is usually generated from `composer.json` and `composer.lock`. Do you have a good reason to include `vendor/` in your repository? – ChrisGPT was on strike May 05 '15 at 21:21

2 Answers2

2

So your problem is that you have a git repository in which resides another repository. I don't know why, but sometimes git silently ignores subdirectories which are git repositories themselves.

The cleanest way to do proceed is to add the subfolder vendor as a git submodule. You do this by

git submodule add ./vendor

in your parent git repo after having cloned the vendor repo (that's where you are now). Explaining submodules would be out of scope for a simple post. However, you can think of it as a pointer to the remote vendor repository that other people can use to obtain a full working copy of your workdir tree. Please refer to

git help submodule

for details.

user1978011
  • 3,419
  • 25
  • 38
1

Try this one, it might help

git status
git add
git commit
git push
Ilya
  • 29,135
  • 19
  • 110
  • 158