What's the best way to .gitignore and manage multiple branches?

Currently, our biggest pain point in working with ionic is coordinating different source control branches. We experience the following problems:

  • Different branches wind up with different versions of cordova plugins
  • The various places that keep track of which plugins are installed have different ordering of the plugins (package.json, fetch.json, android.json, ios.json)
  • I know this sounds weird, but the same branch will work on one machine, but not another until we run ionic state reset. Even though we are currently committing build files and all of the plugins.

Can anyone recommend some best practices about what paths to .gitignore, how to manage cordova plugin versions, and what might be causing some of these weird branch issues?

One option might be to .gitignore platforms and plugins, but then it becomes a huge pain when you want to switch branches – you have to reinstall all the plugins and rebuild each time. It also makes it difficult when you create release branches and want to maintain the exact build that was used to create a release.