Let's say I have a Git repo with branch A
and branch B
.
Branch B
is currently checked out (i.e. .git/HEAD
contains refs/heads/B
).
Now, without checking out branch A
, how to view the history (log) of path/file
in branch A
?
Following git help rev-parse
, I've attempted to use git log A:path/file
, but that doesn't seem to work (outputs nothing). Why?
A:path/file
is a shortcut for a name (an identifier) of a specific tree or blob object. Forgit log
to follow history you need to start from commit-ish.git log path/file
work?git log path/file
isgit log HEAD -- path/file
.