Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do docs explain why "git log" output differs based on checked-out branch?

Tags:

git

git-log

The output from git log is different based on what branch I currently have checked-out. Where in the git documentation does it explain this behavior?

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.

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. 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, i.e. the tip of the current branch.

So, for example, the following would be equivalent:
git log master.. is equivalent to:
git log master..HEAD

git log ..master is equivalent to:
git log HEAD..master

But, if both <since> and <until> are omitted, then what?
git log is NOT equivalent to:
git log HEAD..HEAD

So what is git log equivalent to in the <since>..<until> format?

And if only one commit is listed, but not .., then what?
git log foo equivalent to:
git log foo..HEAD or
git log HEAD..foo ?

like image 514
Rob Bednark Avatar asked Aug 13 '26 03:08

Rob Bednark


1 Answers

One of the first sections of git-log man page:

<since>..<until>

Show only commits between the named two commits. When either <since> or <until> is omitted, it defaults to HEAD, i.e. the tip of the current branch.

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.

like image 179
max Avatar answered Aug 18 '26 14:08

max



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!