Problem
I'm trying to view the contents of a file located in a branch named wip
like so:
git show wip:local-config.php
However, I'm receiving the following error:
fatal: Path 'local-config.php' exists on disk, but not in 'wip'.
What I tried
I tried correcting the path but it failed:
git show wip:./local-config.php
Rather than using another branch, I tried to reference a previous commit from the same branch like so:
git show cd14704:local-config.php
That gave this error:
fatal: Path 'local-config.php' exists on disk, but not in 'cd14704'.
Finally when I try to show the current local-config.php
I get no output at all:
git show local-config.php
The docs
According to the manual this is possible: https://www.kernel.org/pub/software/scm/git/docs/git-show.html. What am I doing wrong?
local-config.php
present in a commit within thewip
branch? It sounds as though git is not tracking the file, or has only begun tracking the file in your current index, and there are no commits which contain the file. – Proteinasegit ls-tree wip
to see if there's a blob under a name of interest recorded in the tip commit of the branch "wip" without checking it out. – Sapless