Should I use .gitignore for Laravel?

I am wondering if it is not an acceptable practice to NOT use the whole .gitignore and do everything that is, at least for small and medium-sized projects. Laravel, like any structure I can imagine, has a lot of dependencies, so they are configured to be ignored with git. Here's what my .gitignoredefault file looks like :

/vendor
/node_modules
/public/storage
Homestead.yaml
Homestead.json
.env

I understand that vendorthey node_modulescontain dependencies. Homesteadfiles are the parameters of the local computer, but it .envcontains the environment parameters and differs between local and remote servers. I'm not sure about it storage.

I had a problem when I got a lot of dependencies, which I am not very well tracked, and my catalogs node_modulesand vendorexploded in the 1 GB 150 000 files. I quickly realized that this was a mistake, and tried to revert to the previous version. This, of course, did not work, because these two folders were not tracked.

After I spent a day rebuilding my project from scratch, I am now tempted to delete all .gitignorefiles from my Laravel project. Given that I only use git locally and don’t click on a live server, is it good to do all this? Does anyone else do this?

+4
source share
2 answers

The answer is in two parts.

Explosion

, / node_modules . - npm ( --save npm), composer.json package.json . , ( vendor + node_modules) , package.json composer.json - , / jsons.

...

, / node_modules ? , . , .

(github, bitbucket ..), , git push ? , , . , , .

, php artisan migrate , , , git hooks, (, , //). install + npm package.json composer.json( git). , , / jsons - β„– 3.x.x - , , , .

+1

gitignore. (. FAQ Composer). , /node_modules composer install/npm install, composer.json/package.json .

.env

.env, , , , ​​ , gitignore, , , (, GitHub).

, , , .

+1

Source: https://habr.com/ru/post/1649989/


All Articles