How do you keep your development scripts in sync with your source code management (SCM) and your projects?
For instance right now I have things like D:\code\reusable-stuff
that goes to an SCM (e.g. GitHub, Bitbucket, ...). Then in my projects I copy the particular scripts I want to use. However this is a pain and inefficient because it's very rare the script is just used as is. So I tend to avoid keeping things in sync, and rely on occasional big all-in-one lump commits that wave away many benefits of using revision control and inevitably leading to more headaches later.
To illustrate with a single concrete example:
There is a script D:\code\reusable-stuff\conversion\clip_all_layers.py
(along with a dozen other scripts in the same folder, none of which I care about right now).
Clip_all is replicated in Project_2015_01\scripts\clip_all_layers.py
, which is used in Project_2015_01\Toolbox.tbx\Awesome_Hicky_Model
.
I discover an off-by-one bug which meant in some circumstances every 2nd layer is skipped.
I change and test in situ with the project data where the bug was encountered. It takes 3 hours to come to a clean working copy, with a dozen intermediate changes and tests. The first 3 changes are dutifully replicated to D:\code and committed, but the ones between r3 and r12 go bye-bye; too much work. Oh yeah, when committing r12-final from d:\code, another fix was discovered, so we had to replicate back to the project.
2 weeks later, I'm looking at the undocumented jump between r3 and r13 and scratching my head. Important logic is missing and I no longer remember enough to know why solution X was used, and today I need to know that.
There has to a smoother way.