If you use the Ionic CLI to create your project:
ionic start <name of project> blank <other options>
(This may not have been around when the Q was posted...)
It will have some .gitignore
files included; However, if you want to look for additional files to exclude, you can look at GitIgnore.IO, and search for "Ionic". You may also want to look at files for your OS, IDE/editor, and other tools (i.e. "VisualStudioCode", etc.), to find additional files to add.
As mentioned in Non's answer, if you add the .gitignore
after having made commits (per your question), you will get some strange behavior, because files already in the repo will continue to be tracked. You can use the command:
git update-index --skip-worktree <files>
To stop git from trying to track them, as explained in this answer. This shouldn't have any downsides, unless you eventually wish to track those files again, you will need to use git update-index --no-skip-worktree <files>
to make them trackable again.