5

I'd like to be able to associate an image with some of my commits, so that I can browse through them at a latter date. I code a lot of visualisations and often find myself wanting to go back to a certain itteration of a graphic that I had done a few days before, in a given project, but struggle to find which actual commit it was by just reading through the comments. If I was able to save a screen grab with my commits, then it would be much easier to pick out the commit I'm interested in.

In Mike Bostock's talk at the Open Vis Conference this year, he talks about an internal tool they created at the New York Times, called Preview, which achieves this functionality; I'm hoping that someone on SO will be able to point me a similar tool which is available to the public.

I've also come across an amusing tool called lolcommits which uses your webcam to take a selfie on each commit (their website says that git blame has never been so much fun!); so close to what I want, just the wrong image!

1 Answer 1

2

Taking and saving the screenshots are easy enough just use the pre-commit/post hooks to generate a screen shot of the image(s) that you are interested in.

The problem is that the git browser doesn't let you view them if they are committed so why not use a simple python script to generate low definition views of the, (potentially only the changed), graphics in your source tree and save them to a directory based on the commit ID possibly generating a web page for that commits - possibly with an automatically generated text for update to that commit.

If your graphics are produced as a result of running the code your pre-commit script could even include a build into a test program which outputs the images.

2
  • are you aware of any such script?
    – Ooker
    Oct 11, 2022 at 9:49
  • @Ooker - The python based pre-commit tool is highly customisable and aware of which files have changed as well as which issue(s)/ticket(s) are mentioned in the commit message. The Pillow library can be used to generate screenshots so I would use that to automate adding a screenshot or images to the first referenced issue (most issue trackers can add images) or to a fixed issue number possibly in response to a keyword in the commit message. If the screenshot was done in the post-commit hook then the SHA could be included. Oct 12, 2022 at 5:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.