|
From: | Davis Herring |
Subject: | Re: git log question |
Date: | Thu, 30 Nov 2017 10:06:00 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 |
I find the following puzzling: steve [ ~/git/emacs-master ]$ git log --oneline | grep b407c521f2 b407c521f2 Remove pinentry.el steve [ ~/git/emacs-26 ]$ git log --oneline | grep b407c521f2 The latter gives no output; yet:
This command of course answers your original question: "Is commit C on branch B?". You could use "grep -q" to make it a test, but "git merge-base --is-ancestor C B" is more efficient.
steve [ ~/git/emacs-26 ]$ git log --oneline b407c521f2 -1 b407c521f2 Remove pinentry.el That is, `git log' invoked with a specific commit will find that commit even when it's not on the current branch but on another branch in this repository,
"git log" == "git log HEAD"; "git log X" reports X itself and all commits in its history.
but it appears unable to say which branch it's on.
This is a different, dual question: "Which branches contain commit C?", for which the command is "git branch [-r|-a] --contains C".
Davis --This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.
[Prev in Thread] | Current Thread | [Next in Thread] |