I have a slightly unusually situation: I have scripts that I make small changes to frequently, and that take hours to execute.
I save output logs, but more importantly I need to make sure that the code which produced a given log will not be lost.
Committing changes before each run will work, but I'd like to enforce this automatically by preventing my code from running if git is not up to date.
Is there a simple way to do this, or is running shell commands and scraping output my best bet?
You could consider running your script from a separate checkout to where you do your development. That way you would need to commit, push locally, and pull in the 'deployment' location before you could run the updated script. You could probably automate those steps with a shell script or even a git commit hook.
only run python script if it is git committed