[英]Where do docs explain why "git log" output differs based on checked-out branch?
The output from git log
is different based on what branch I currently have checked-out.来自git log
的 output 根据我当前签出的分支而有所不同。 Where in the git documentation does it explain this behavior? git 文档在哪里解释了这种行为?
I looked at git log --help
and git rev-list --help
but don't see anything explaining the that git log
is context-sensitive based on which branch I have checked-out.我查看了git log --help
和git rev-list --help
但没有看到任何解释git log
基于我签出的分支是上下文相关的。
EDIT:编辑:
I had read the following section that @max and @James mentioned, and it's clear what happens when one of the commits is omitted and ..
is specified.我已经阅读了@max 和@James 提到的以下部分,并且很清楚当省略其中一个提交并指定..
时会发生什么。 But it's ambiguous what happens when both commits are omitted.但是当两个提交都被省略时会发生什么是模棱两可的。 And it's also ambiguous when one commit is omitted and the ..
is omitted:当一个提交被省略并且..
被省略时,它也是模棱两可的:
<since>..<until> <从>..<直到>
Show only commits between the named two commits.仅显示指定的两个提交之间的提交。 When either <since> or <until> is omitted, it defaults to HEAD, ie the tip of the current branch.当 <since> 或 <until> 被省略时,它默认为 HEAD,即当前分支的尖端。
So, for example, the following would be equivalent:因此,例如,以下内容是等价的:
git log master..
is equivalent to: git log master..
等价于:
git log master..HEAD
git log..master
is equivalent to: git log..master
等价于:
git log HEAD..master
But, if both <since> and <until> are omitted, then what?但是,如果 <since> 和 <until>都被省略了,那又如何呢?
git log
is NOT equivalent to: git log
不等同于:
git log HEAD..HEAD
So what is git log
equivalent to in the <since>..<until> format?那么,<since>..<until> 格式中的git log
等价于什么?
And if only one commit is listed, but not ..
, then what?如果只列出了一个提交,但没有列出..
,那会怎样?
git log foo
equivalent to: git log foo
等价于:
git log foo..HEAD
or git log foo..HEAD
或git log HEAD..foo
? git log HEAD..foo
?
One of the first sections of git-log man page :git-log 手册页的第一部分之一:
<since>..<until> <从>..<直到>
Show only commits between the named two commits.仅显示指定的两个提交之间的提交。 When either <since> or <until> is omitted, it defaults to HEAD, ie the tip of the current branch.当 <since> 或 <until> 被省略时,它默认为 HEAD,即当前分支的尖端。
git log
needs a point (or points) to start from, so when no revision is provided, it defaults to HEAD
, which points to current branch. git log
需要一个(或多个)点开始,所以当没有提供修订时,它默认为HEAD
,它指向当前分支。
Git log has an implied argument HEAD so when you do Git 日志有一个隐含的参数 HEAD 所以当你这样做时
git log git日志
you are actually doing你实际上在做
git log HEAD git 日志头
which means you will get the log from the tip of the current branch这意味着您将从当前分支的尖端获取日志
From Git Log Manual for since..until options从Git 日志手册中获取 since..until 选项
Show only commits between the named two commits.仅显示指定的两个提交之间的提交。 When either or is >omitted, it defaults to HEAD , ie the tip of the current branch.当 或 被 > 省略时,它默认为 HEAD ,即当前分支的尖端。 For a more complete >list of ways to spell and, see gitrevisions(7).如需更完整的 > 拼写方式列表,请参阅 gitrevisions(7)。
As per updated question the following should explain all the situations you stated根据更新的问题,以下应解释您所说的所有情况
From Git Revisions从Git 修订
For example, origin.. is a shorthand for origin..HEAD and asks "What did I do since I >forked from the origin branch?"例如,origin.. 是 origin..HEAD 的简写,并询问“自从我 > 从 origin 分支分叉后我做了什么?” Similarly, ..origin is a shorthand for HEAD..origin and >asks "What did the origin do since I forked from them?"类似地,..origin 是 HEAD..origin 的简写,并且 > 询问“自从我从他们那里分叉后,origin 做了什么?” Note that.. would mean >HEAD..HEAD which is an empty range that is both reachable and unreachable from HEAD.请注意,.. 意味着 >HEAD..HEAD 是一个空范围,可以从 HEAD 到达和无法到达。
If.. is omitted then it is just如果.. 被省略,那么它只是
git log <rev>
which include commits that are reachable from (ie ancestors of) rev.其中包括可从 rev (即祖先)访问的提交。 This is explained in git-rev-list who's options are applicable to git-log as stated in the manual.如手册中所述,这在git-rev-list谁的选项适用于 git-log 中进行了解释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.