what folder/files are ignored for git commit | gitignore vue example

This tutorial explains how to add a .gitignore file and what content added to this in the VueJS application

What content was added to Gitignore file in VueJS application

The path of files or directories in your application are listed in the .gitignore file. These files are not committed during git push or commit operations.

A New Vuejs applications prototype was created using Vue-CLI, and By default, It generates gitignore files which have the following content.

.DS_Store
node_modules/
dist/
npm-debug.log

If you open your project with Visual Studio Code, it creates some caching files.

So you need to add those in the gitignore file.

  • VScode configs
.vscode

if you are using sublime editor, You have to add the below files in gitignore

  • SublimeText configs
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
*.sublime-workspace

the .idea folder was generated for the Intelli idea editor. so add this path in the gitignore file.

.idea
.idea_modules/

Vuejs projects install dependencies to node_modules during npm installs And also building project generates files and outputs to the dist folder

node_modules/
/dist

If your project is using grunt or bower package manager, just add the below things

### package manager config
.grunt
bower_components

API secret key information is stored in environment configurations using the dotenv library.
# dotenv environment configs
.env
.env.test
.env*.local

Finally, add cache-related files as described below

.npm
# eslint cache
.eslintcache

# stylelint cache
.stylelintcache

node npm and yarn package manager generates debug log files, Added below files

.npm
# eslint cache
.eslintcache

# stylelint cache
.stylelintcache

gitignore example file for vuejs application

Like any node application, there are a lot of similar things which you have to add to the Vuejs application.

Here is a complete .gitignore file for the vuejs application

.vscode

# package manager log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.npm
# eslint cache
.eslintcache

# stylelint cache
.stylelintcache


# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

node_modules/
/dist

Conclusion

gitignore is an important step to add the files that ignore during the git commit.

So, Please make sure to add to it based on your application requirements.