I cannot find a reasonable solution, because I consider it a very simple task. Think I have some sort of source directory in my project where all the source files are. In development mode, I change the source files, and Gulp overrides them in .min.js and .min.css and puts them in the public directory (to clarify, I am creating a node.js application).
Now I have two branches: master for production and development for development.
.gitignore file on master branch
.DS_Store node_modules source ...
.gitignore file on development branch
.DS_Store node_modules public/javascript public/stylesheets ...
The behavior I want to get is: 1) ignore mini files for development (they are collected and minimized every time I change the code anyway), but keep the source; 2) ignore the source files for production (since I donโt want to have them when I $ git pull it in the production environment), but keep decreasing.
For some reason, when I switch back and forth from master to development , git completely deletes some files and splits everything. For example, it erases the entire contents of each module in node_modules , forcing me to do $ rm -rf node_modules && npm install every time I switch branches.
Any help is greatly appreciated.
The problem is also described here: Using git, how to ignore a file in one branch, but it was moved to another branch? but without working solutions.
source share