I use Git (2.39.2.windows.1) and Qt Creator 7.0.2 on Windows 10. I would like Git to show me files at specific revisions (as in git show <revision>:<relative/path/to/file>) in the instance of Qt Creator that is currently open.
Alternatively, Qt Creator has some Git integration, but I do no see this possiblity under Extras > Git. Is there one, actually ?
The -block option of Qt Creator offers me pretty much that. If I run
qtcreator -block path/to/file.cpp
Then I get the file opened in my Qt Creator instance until I close it there. But if I set the pager for git show to be qtcreator -block then nothing happens when I run git show <file>.
I also tried the syntax qtcreator -block $1 to specify that one argument is expected fropm the caller (that would be the copy of the file at the specified revision, retrieved by Git who calls the pager), but that does nothing more, so still nothing.
Based off the comments above it sounds like specifying either the
GIT_PAGERorPAGERenvironment variable might be what you want:The pager is expected to read from stdin, which means that you might need to create a small wrapper script that does that and then writes the content to a temporary file:
Then specify the
GIT_PAGERin your rc file:Then when running
git showthe pager will be picked up.This however have one huge downside which is that the
GIT_PAGERenvironment variable will be picked up bygit log,git diff, et al.Which means that you properly want to specify the pager as a config option:
As the config name indicates this sets the pager for the "show" sub-command.
If you don't fancy bash, then I'm sure it easy to rewrite in Python, Perl, JavaScript or whatever.