1

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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You can run a simple shell script that checks if the file is not marked as modified before running:

git status -s your_script.py | grep "^ M" || ./your_script.py

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.