Background:
We created files in our system that should be committed in the final state (for example, we cannot rely on the source (non-generated) files and do the ones generated on the fly). Since we need the generated files, these files cannot be git ignored.
Problem:
Files cause a lot of errors Your local changes to the following files would be overwritten by merge from git when checking and pulling commands.
When I pull or check, I don't care what my files are, I only care about new files. (Obviously, I really care about the source file that creates the generated files. I'm glad for the merge warnings in the source file, which is stored in a different directory.)
However, when I commit, I want my version to โwinโ and my generated files to be committed.
Possible Solution:
Now I just run git checkout -- generated-files/ before outputting or checking for reset my generated files and skip any merge errors. It works, but I often forget to do it, and I would like to automate it if possible.
I looked at the preliminary check and tightened the hook, but git does not provide them :(
Questions:
- Is there a better way to handle generated files?
- Is there a way to get
git checkout -- generated-files/ to work before pulling or checking? - How do you work with generated files in git?
source share