Answer the question
In order to leave comments, you need to log in
How to ignore files from git repository?
For the umpteenth time I try to solve this problem for myself, but it does not work. The situation is something like this:
- I'm developing a website at home, let's say I'm working on the frontend, and this, in short, is js, scss, which are then converted and minified, mapped. All this business I send to a repository.
- then I come to the office, download from the repository what I did at home. Ok, I continue to work, I have all the sources, everything is convenient.
And now I solved the problem, I need to upload it to production. But in production, scss is not needed, ready-made and compressed css is needed there.
Tried to add ignoring these files in `.git/info/exclude` - didn't help, tried in `~/.gitexcludes` (of course with setting in .gitconfig) - didn't help. I even tried to do the same with a completely empty project (well, you never know indexed files, etc.), but even with an empty project, unnecessary files are pulled from the repository.
I searched on the Internet, but there are solutions for files that accidentally leaked into the repository and need to be urgently disposed of, or how to ignore it and not send it to the repository, or the same `git update-index --assume-unchanged`, which is enough for one time, Yes, and you will go crazy all the files one by one so parse.
I'm coming to the conclusion that there is no solution. But maybe I'm wrong and someone will tell me?
Answer the question
In order to leave comments, you need to log in
it is impossible to ignore what is already under control.
you can locally remove the file from control, add it to ignore, and everyone who clones after that will have it ignored.
Set up a path to save the generated css files to outside the git repository, for example the second one, creating it specifically for production ready files. Those. it is he who should be used to transfer the final files to production. or create a special subdirectory inside git, adding it to .gitignore, and install it in production in other ways.
sass style.scss:../prod/style.css
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question