如何`git log`来自另一个分支的树状结构?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18830659/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to `git log` a tree-ish from another branch?
提问by ulidtko
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
?
假设我有一个带有 branchA
和 branch的 Git 存储库B
。
分支B
当前已签出(即.git/HEAD
contains refs/heads/B
)。
现在,没有检查出的分支A
,如何看待历史(日志)path/file
的分支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 help rev-parse
,我尝试使用git log A:path/file
,但这似乎不起作用(不输出任何内容)。为什么?
回答by patrickvacek
Try this (without the angle brackets):
试试这个(没有尖括号):
git log <branch> -- <path/to/file>
git log <branch> -- <path/to/file>