What not to commit for Angular 2|4|5|6|7|8|9 Project - Gitignore file template example

In this blog post, We are going to learn the files not to commit for the angular project.

gitignore file for the angular project

gitignore file is used to maintain untracked files which will be useful during git commit process to ignore the files.if each line added in gitignore file is to stop tracking the files during commit files. The angular project can be generated manually as well as an angular CLI tool.

The angular project uses typescript. Typescript compiler or transpiler the components into javascript. During this stage, js and js.map files are generated. This can be ignored by adding it in gitignore file

We will see the gitignore file for angular cli project

gitignore file is created by default during angular project creation using cli tool

what not to commit for git in a angular cli project

  • Node_module dependencies folder that does not need to commit repository
  • Build package log files like npm and yarn as well as webpack
  • temporary folders like tmp
  • typings folder
  • Output folder of npm command execution like dist/output folder
  • output files of typescript compiler files
  • include mapping javascript files if any
  • environment-specific files
  • exclude package-lock.json file
  • bower_components if package manager used is bower
  • Editor or IDE-specific files like the .vscode folder for Visual Studio code editor 
  • *.sublime-workspace files for Sublime text editor
  • .project and classpath files for eclipse
  • typescript generated files
  • grunt specific lock files

gitignore file template example 

We have to add the following things to gitignore file to ignore the files

# See http://help.github.com/ignore-files/ for more about ignoring files.  
# compiled output  
# dependencies  
# IDEs and editors  
# IDE - VSCode  
# misc  
# System Files  

Based on project needs, You can add/remove any directory or files in this files. You have to use regular expression ** to ignore subdirectories inside a directory,

Similar Posts