Merianos Nikos Merianos Nikos - 2 months ago 9
Git Question

composer module it is git modified but it is not staged on git

I have start a new project using

composer
. The project it is version tracked using git.

The thing is that I have install the component
"zendframework/zend-session": "^2.7"
and now when I try to perform a
git add vendor/zendframework/zend-session
and then I run the
git status
I get the following result:

On branch feature/install-session-manager
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)

modified: vendor/zendframework/zend-session (modified content)

no changes added to commit (use "git add" and/or "git commit -a")


Note: of course and I don't have modify the code of the files in the folder
vendor/zendframework/zend-session


Does anyone know how can I finally stage this modifications on my
git
repository ?

Answer

You need - and it's a very good practice - to add vendor folder to .gitignore

That way every developer can have a different local version of vendors and you don't need to store/retrive them into your git repo

To add it to .gitignore just put the string vendor in the file

To untrack previous files that are now under .gitignore just run

git rm -r --cached .