Reputation: 133
I have got following problem:
I installed some dependencies (symfony) into my project using composer install
.
BUT when I'm trying to commit that, It can't see any files.
I've searched every .gitignore file, but I think this is not caused by ignoring these files - I've checked it with SourceTree and these files are not even in "ignored" or "all", they simply don't exist in git at all.
So, I've tried git add vendor/symfony/*
, git add vendor/symfony/*/*
etc., but it just added some folders into commit, and not files.
When I move entire symfony folder, nothing changes. Same if I rename something. But, if I make some file in symfony folder, which contains just other folder (no files), it appears. But - if I make file next to another files in symfony, it won't appear.
I've looked into /.git/info/exclude, but there is also nothing suspicious.
Platform: Windows 7 x64 git 1.8.4
Is there something about composer I don't know? Or am I missing something?
Thanks for answers.
EDIT:
Well, it is kinda strange, but I made it work.
First I tried to add single file with its full path (with git add
). CMD throwed error, it is unable to add, because this file is in submodule.
According this advice I've tried git rm --cached -r vendor/symfony
, and it probably cleared some references.
Then I could call git add
again, BUT I had to use path to files (there was many embed folders) like git add vendor\symfony\browser-kit\Symfony\Component\BrowserKit\*
.
I actually don't know what happened, but after I made .bat file and call this on all files there, I can commit it.
Thanks for your time, help and advices. :)
Upvotes: 4
Views: 1923
Reputation: 70863
You are expected to add the whole vendor
folder into .gitignore
and not commit these dependencies into your own repository.
You can commit them, but if you happen to clone Git repositories, these will always be added as submodules, and I have been told they are not the best idea for Git. I would expect you to experience issues when trying to update.
I have very good experience with not committing these files, but to add a post-checkout hook into my local Git repo executing composer install
. I only commit the composer.lock
file. That way the repository stays small, but every checkout automatically updates all the dependencies.
Additionally, I have Phing scripts running tests, and as one step before that, composer install
is also called.
Upvotes: 1
Reputation: 68
I am still new to git but I can share my own personal experience with adding files. I am still using various programs until I find a way that works best for me. I have installed MySysGit, TortoiseGit, and since I use GitHub I have the GFW program which installs PowerShell along with it.
The first thing I would type is git status
. If you have untracked files then try to add the folder without the *
. I have seen it recursively add files in the folder I specify and its sub directories. If that doesn't work then use TortoiseGIt.
git add vendor/symfony
As long as there is a vendor/symfony where you are in the shell it should add the files and it's sub directories.
Right click the folder and look for a blue cross that says add
. Once it discovers all the files select all and let it process them. Then use git status again to see what changed and possibly what else you need to do.
As long as there are untracked files TortoiseGit should add them and any sub directories.
If git status
doesn't show any untracked files, and there is no vendor/symfony in the git repo on your hard drive then I'd check and see if composer install
needs other arguments to place the files where you expect them to go.
Upvotes: 1