I want to show the contents of a file given by a path at a specific state of a git repo. I unsuccessfully tried this:
git show f825334150cd4bc8f46656b2daa8fa1e9
The syntax you're using matches that shown in the examples for the git show
manpage, but git
seems to be hinting that you should specify like this:
# I _don't_ think this is your answer...
git show f825334150 -- Katana/source/Git/GitLocalBranch.h
which I've definitely used for git log
and is in its manpage.
My gut, though, tells me that you using an absolute path and not the path inside the top of your git work tree. You need to make sure that if your .git
directory is at Katana/source/Git/.git
, then you chop off everything before the .git
, like so:
git show f825334150:GitLocalBranch.h
If you're trying to show a git blob from outside the git working area, you need to do something like this:
GIT_DIR=Katana/source/Git git show f825334150:GitLocalBranch.h
This will tell git where it can find the data for the your repository.
Bottom line: double-check your paths and make sure they're right. You might need to set a GIT_DIR
if you're not running your command from inside the git work area.
It's probably problem with your path specification.
This works, shows version of Makefile in commit b1b22df407417...
git show b1b22df407417:Makefile
Or current version in master branch
git show master:Makefile
Or current version in exper branch:
git show exper:Makefile
Or previous version on the exper branch:
git show exper^:Makefile
And so on