ionic gitignore file| Ignore files in git ionic example
In this blog post, We are going to learn the files not to commit for the ionic project. It includes a step-by-step ionic gitignore example.
ionic gitignore file example
.gitignore is a plain text file that contains files and folder paths ignored by git during the git commit command.
.gitignore is stored in the application’s root directory. You can, however, define it in any of your application’s subfolders.
Any editor, including
plain text editors, can be used to modify or create this.
The gitignore file is used to maintain track of untracked files that can be skipped when committing to git.
.gitignore is a simple text file that contains the path of files and folders of a current project.
gitignore files are created automatically during the creation of the ionic project with the Ionic CLI tool. However, You can still manually add the file if the application was created manually.
We will see the gitignore file for the ionic CLI project.
Let’s see what files do add to the .gitignore file in the ionic app.
Node_moduledependencies folder, which is local to the project, and environment, not required to commit to the repository.
bower_componentsfor the bower package manager
Build package log files for npm and yarn as well as webpack
*.DS_Store *.log *.swp *.swo *.log
temporary folders like tmp
- environment secret keys
- typescript generated files
- grunt specific lock files
ionic gitignore file example
We have to add the following things to the gitignore file to ignore the files in the ionic project.
Here is a code for the
ionic gitignore sample file example.
# See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output /dist /tmp /temp /out-tsc # dependencies /node_modules /bower_components # IDEs, eclipse, and Editors /.idea .project .classpath .c9/ *.launch .settings/ *.sublime-project *.sublime-workspace npm-debug.log* .ionic/ .sourcemaps/ .sass-cache/ # IDE - VSCode .vscode/* !.vscode/settings.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json # miscellinous /.sass-cache /connect.lock /coverage /libpeerconnection.log npm-debug.log yarn-error.log testem.log /typings # Generated System Files .DS_Store Thumbs.db # Platform for android files platforms/ platforms/android/ platforms/ios/build plugins/ resources/ www/lib # environment files .env .env-prod
.gitignore for an Ionic project with an Android target
In Ionic projects, We have plugins and platforms to add to the gitignore file for Cordova plugins. platform/ios and platform/android folders are not committed to the git repository.
platforms / plugins / plugins / android.json; plugins / ios.json;
if you are using a capacitor, There are some more entries to add
contents.xcworkspacedata android-template/.gradle/ android-template/app/app.iml android-template.iml
- environment secret keys and confidential information will not commit to git, So don’t add these to the gitignore file
- You can use any text editor to create and modify the file.
- It does add to any folder of your project. A root project is a good way to apply the entire project
- Ionic 3 and ionic 4 versions work with similar gitignore content.
Based on project needs, You can add/remove any directory or files in these files. You have to use the regular expression ** to ignore subdirectories inside a directory.