How do you deal with git merge/rebase and public assets?
Hello,
as the title says, how do you deal with public assets and git merges/rebases when you know that after the merge, you'll run gulp and overwrite the files and conflict tags inside the files?
I am asking because I've noticed that when I am merging something (git merge or git pull), I get into this problem almost all the time.
I've asked on Slack, and one person suggested a use of a CDN where I put all of my assets to a separate server, independent of the server where the main app stays. It sounds like a good idea but it seems like an overkill for small projects.
Is there any alternative way to manage public assets and avoid this problem and potentially extra commits just for the public assets?
I am talking about scripts and styles. all.js, all.css and friends.
I am not losing them but when you usually work on a different branch, you have some feature that is not part of the master, development or other branches. So, when you merge / rebase the feature into the development or master branch, you might get some conflicts. Also, when working with a team, someone added a few lines of JavaScript and Git cannot auto merge those changes so a conflict shows up in the compiled files.
The files on master and development can't be the same because there are some additions / refactors on developmentand master is a few commits older.
It does not happen all the time, but when it does, it seems like something is missing.
I tend to only use all.js/css for core stuff that's used on every (or the vast majority) of pages in the site - and that tends not to change much or need re-minified etc. Anything else just gets included on the sub-view it's related to. Makes my life easier - though I'm not doing any JS-crazy sites, but ymmv as always ;-)
@RUFFLES - @ruffles did you find any solution ?
I'm facing same problem when merging branch i get merge conflict in compiled files particularly all.css and all.js . I am not able to get proper workflow for that.
One solution i found is this : i can gitignore public/js and public/css and then do build process for production on production server. But i dont want to do that.
My current workflow :
My workflow is i develop on master branch and once everything working properly i merge it with staging and production branch.
What i want to do:
If i can avoid merging just compiled files then after merging i can run npm prod on staging and production branch and then push to remote for deployment. This way my production server can have compiled files and i can avoid running npm prod on server.
I've searched whole forum for this particular issue but no one have any proper workflow for this particular issue. Mostly all suggest to use npm install and npm run prod on production server but that i don't want to do. If i can get away with some git workflow it would be great. Thanks