I'm using the Joomla Component Creator to generate scaffolding code for components. After designing the tables, fields, relations etc. the component is built, and I install it on the website that is being developed. Then I make some changes to the generated code, where this is needed. However, if I find I need some extra fields, another table, or some other change that the component creator can take care of for me, I go back to the component creator, make the desired changes, build the component, and install it again. But now all my own changes will be overwritten. I am using git, so it is possible to find the places where my own code is overwritten and undo this, but it is cumbersome and not always obvious to find my own changes.
So: Is there a better way to do this? Some trick with git or whatever? Or just some good guidelines for what I should do? I understand I can make good comments before and after my own code-changes to spot these more easily, but it is still a lot of work if the code is changed many places in many files.
You can have one branch "vanilla" where you simply track the generated code.
For your manual changes, you create a new branch (e.g. "installationA") and base it on the head of "vanilla". You do some more manual changes on "installationA", when you decide that you need to re-run the generator (with a changed configuration). What you do then is the following:
Real conflicts need to be resolved from hand of course, but a lot of work should be done automatically. This setup allows you to keep track of two different sources of changes. On the one hand "the baseline" (a.k.a "vanilla") and on the other hand your manual changes / site-specific adaptions. This works quite well if you have multiple installations ("installationB", "installationC", ...) that both consist of some adaptions to a common baseline.