How to `git log` a tree-ish from another branch?

GitGit Log

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

Try this (without the angle brackets):

git log <branch> -- <path/to/file>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionulidtkoView Question on Stackoverflow
Solution 1 - GitpattivacekView Answer on Stackoverflow