Git ignore for Ionic project

You can use this gitignore

node_modules/
temp/
*.DS_Store
*.log
*.swp

For more details view this link http://forum.ionicframework.com/t/whats-a-good-gitignore-for-an-ionic-project/4115


When using Ionic 2, the scaffolder (starter) project provides you a .gitignore file out of the box. It pretty much covers all the essential files that one wishes to untrack.

The .gitignore file present in your starter project should look like this:

# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore

*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
*.sublime-workspace
.vscode/
npm-debug.log*

.idea/
.sass-cache/
.tmp/
.versions/
coverage/
dist/
node_modules/
tmp/
temp/
hooks/
platforms/
plugins/
plugins/android.json
plugins/ios.json
www/
$RECYCLE.BIN/

.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate

For how to boot up a scaffolder Ionic 2 project, given that you have all the pre-requisite npm modules installed:

$ ionic start MyProject --v2

Inside the new directory MyProject/ created just now, you'll find the default .gitignore that comes with this starter/template project structure.


The problem here is that if you already add all those files, once you put the .gitignore it will not work as you want. You need to put the .gitignore at the very beginning of your project.

So, my advise: make another project in Git, just upload your project again and create the .gitignore file. I am telling you this based on my own experience.

The basics of what you should put in that .gitignore

node_modules
.tmp
.sass-cache
**/bower_components or sometimes it is lib/**
platforms
plugins
*.swp
*.swo
*.log
*.DS_Store

in order to create this file, you can do it from Git, or from your terminal:

  1. In Terminal, navigate to the location of your Git repository.
  2. Enter $ touch .gitignore to create a .gitignore file.