I am trying to create a workflow with Git for my personal projects. After reading this Post, A successful Git branching model, I am planning to implement the same in all my projects. The master branch will contain the production code and the develop branch which I use as working branch.
So consider the following directory structure.
bower_components
node_modules
dist
gulpfile.js
index.php
assets
-css
-js
-images
package.json
bower.json
.gitignore
README.md
Obviously, I don't want the bower_components and node_modules to be pushed to my develop and master branch, hence I add it to .gitignore. So the other developers can checkout the develop branch and run npm install and bower install to continue development.
I would like to keep my master(release) branch clean where I don't need package.json, gulpfile.js, bower.json etc.
So the master branch must contain only the below diretories
dist
index.php
dist will be the minified js and css. I want to achieve the above scenario using Git. Either I need different .gitignore for master branch and develop branch or ignore files during git merge.
I have read several SO questions, checkout this question which explains a way to ignore files for branches using excludeFiles option. I have tried it but it doesn't seems to be working. This is the link for the mentioned solution. And this SO answer explains that
Git does not support per-branch excludes files
How can I achieve this above scenario using Git? Which option should I use?