In git, how do I view a previous version of an image file?

341 views Asked by At

I know I can git-show the previous version of a file, but I've got images in my repository! When I git show <revision>:<path-to-image>, it unhelpfully opens them in a pager...

It seems git show doesn't consider environment variables for this: I've tried setting EDITOR=gimp and PAGER=gimp, even VISUAL=gimp to no effect. I can't find anything in man git show about changing the pager application either.

As a workaround, I can git stash save my current changes, git checkout the revision, open the file, checkout back to where I was and git stash apply, but that's a lot of effort that shouldn't be.

How do I do this properly?

1

There are 1 answers

1
qmorgan On BEST ANSWER

You can try piping it to gimp:

git show <revision>:<path-to-image> | gimp