Best Practice Laravel gitignore Best Practice Laravel gitignore laravel laravel

Best Practice Laravel gitignore


First, you can add Laravel default .gitignore content: https://github.com/laravel/laravel/blob/master/.gitignore

And add your js,css directory to .gitignore like this:

/public/css/public/js

Check it:

cat .gitignore/vendor/node_modulesHomestead.yamlHomestead.json.env/public/css//public/js/


Which one should i include on push at the asset folder (use "gulp" on server) or public folder (gulp result)?

Any generated content should not, if possible, be included in a git repo (and pushed)

If you can have a post-receive hook on the server side which executes gulp for you, that would be best.
That being said, this isn't always possible, and on a production server, adding gulp might not be always possible. In that case, versionning the generated content is acceptable.


In an ideal world, you don't want to push generated files to your repository/production server. One reason for this, is that adding constantly changing versions of generated files can cause irritating issues when using git in collaboration with others.

However, every project's situation is different, and sometimes it is easier to version the generated files and to deploy them this way. Particularly if you are working independently of others on the project, there is no real issue with this.