Can I setup .gitignore in such a way to allow Composer dependencies (the vendor directory) to live inside my repository?
Composers officially recommends that you "should not" do this. And it provides three reasons (https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md):
- Large VCS repository size and diffs when you update code.
- Duplication of the history of all your dependencies in your own VCS.
- Adding dependencies installed via git to a git repo will show them as submodules. This is problematic because they are not real submodules, and you will run into issues.
All these three reasons do not matter to me. Also it may be possible that reason three could be obviated by a clever .gitignore.
If it is necessary for me to state a motivation for this question then my motivation is: CocoaPods does it this way and I like how CocoaPods works.
What exactly should I do in .gitignore to achieve this?
rm .gitignore. What am I missing?composer installwith a versionedcomposer.lock"will give 100% sane results"… provided all of the dependencies defined therein are still available and can be retrieved. There are ways it can still fail, and there are situations where one might actually want to includevendor/in their repository.