* git show-branch --topics and merge commits
@ 2011-07-17 23:56 Mike Shal
2011-07-18 2:21 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Mike Shal @ 2011-07-17 23:56 UTC (permalink / raw)
To: git
Hello,
I'm trying to use 'git show-branch --topics' to list the commits on a
branch that are not yet in master. Normally this works fine, but after
merging master up to newbranch, it comes up blank (I would expect to
still see commits on newbranch that aren't on master). Eg, with a
history like so:
$ git log --graph --oneline
* 94968cf Merge branch 'master' into newbranch
|\
| * 223c001 more text
* | 13766bd new
|/
* ad878b4 ok
(newbranch on the left, master on the right)
I get the following output from git show-branch:
$ git show-branch --topics master newbranch
! [master] more text
* [newbranch] Merge branch 'master' into newbranch
--
- [newbranch] Merge branch 'master' into newbranch
+* [master] more text
I would expect to see the 'new' commit here, since it hasn't been
merged to master. The man page for git-show-branch says this should be
equivalent to 'git rev-list ^master newbranch', but when I run that I
get the expected output:
$ git rev-list ^master newbranch
94968cf2753b97481434f0813271659e08811177
13766bdc28df3841e25c43b53748e37f73fadb9f
So rev-list shows my merge commit and the 'new' commit, but
show-branch --topics doesn't show 'new'. Is this the expected
behavior? If so, what is the best way to get a list of changes on a
topic branch that periodically has had the master branch merged into
it?
Thanks,
-Mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git show-branch --topics and merge commits
2011-07-17 23:56 git show-branch --topics and merge commits Mike Shal
@ 2011-07-18 2:21 ` Junio C Hamano
2011-07-18 3:37 ` Mike Shal
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-07-18 2:21 UTC (permalink / raw)
To: Mike Shal; +Cc: git
Mike Shal <marfey@gmail.com> writes:
> So rev-list shows my merge commit and the 'new' commit, but
> show-branch --topics doesn't show 'new'. Is this the expected
> behavior?
Yes, show-branch was specifically written for people with strict sense of
project hygiene who do not merge into their topic from upstream (which
would turn the branch from "place to hold commits on this topic" into
"place to hold commits on this topic and unrelated random changes made in
upstream").
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git show-branch --topics and merge commits
2011-07-18 2:21 ` Junio C Hamano
@ 2011-07-18 3:37 ` Mike Shal
2011-07-18 18:14 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Mike Shal @ 2011-07-18 3:37 UTC (permalink / raw)
To: git
On Sun, Jul 17, 2011 at 10:21 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Mike Shal <marfey@gmail.com> writes:
>
>> So rev-list shows my merge commit and the 'new' commit, but
>> show-branch --topics doesn't show 'new'. Is this the expected
>> behavior?
>
> Yes, show-branch was specifically written for people with strict sense of
> project hygiene who do not merge into their topic from upstream (which
> would turn the branch from "place to hold commits on this topic" into
> "place to hold commits on this topic and unrelated random changes made in
> upstream").
>
>
Ok, makes sense. Is 'git rev-list' supposed to give the same list of
commits then? In my example, rev-list shows the commit on the branch
even after upstream has been merged in. My confusion comes from this
line in the man page of git-show-branch:
When given "git show-branch --topics master topic1 topic2", this
will show the revisions given by "git rev-list ^master topic1 topic2"
Thanks again,
-Mike
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git show-branch --topics and merge commits
2011-07-18 3:37 ` Mike Shal
@ 2011-07-18 18:14 ` Junio C Hamano
2011-07-18 23:34 ` Mike Shal
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-07-18 18:14 UTC (permalink / raw)
To: Mike Shal; +Cc: git
Mike Shal <marfey@gmail.com> writes:
> Ok, makes sense. Is 'git rev-list' supposed to give the same list of
> commits then? In my example, rev-list shows the commit on the branch
> even after upstream has been merged in.
"show-branch" was designed to stop after seeing a commit that are shared
with all the branches it was given, so
git show-branch A B
is more like
git rev-list --left-right --boundary A...B
and not at all like
git rev-list A..B
which is to show all commits not in A that appear in B.
Note that show-branch was invented way before the log family of commands
(which rev-list is a member of) learned --left-right/--boundary/--graph
options, and I personally think its graphical output mode outlived its
usefulness as a stopgap measure. As its "merge-base" and "independent"
modes have also been made redundant (see "git merge-base" for two options
to mimic their behaviour), we may want to start thinking about deprecating
the command, and the first step perhaps would be to replace its mention
from the first part of the Everyday Git document with something more
appropriate such as "git log".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git show-branch --topics and merge commits
2011-07-18 18:14 ` Junio C Hamano
@ 2011-07-18 23:34 ` Mike Shal
0 siblings, 0 replies; 5+ messages in thread
From: Mike Shal @ 2011-07-18 23:34 UTC (permalink / raw)
To: git
On Mon, Jul 18, 2011 at 2:14 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Note that show-branch was invented way before the log family of commands
> (which rev-list is a member of) learned --left-right/--boundary/--graph
> options, and I personally think its graphical output mode outlived its
> usefulness as a stopgap measure. As its "merge-base" and "independent"
> modes have also been made redundant (see "git merge-base" for two options
> to mimic their behaviour), we may want to start thinking about deprecating
> the command, and the first step perhaps would be to replace its mention
> from the first part of the Everyday Git document with something more
> appropriate such as "git log".
Hmm I had no idea 'git log' was so powerful. I'll be using that from
now on instead of show-branch --topics :)
Thanks for your detailed response,
-Mike
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-18 23:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-17 23:56 git show-branch --topics and merge commits Mike Shal
2011-07-18 2:21 ` Junio C Hamano
2011-07-18 3:37 ` Mike Shal
2011-07-18 18:14 ` Junio C Hamano
2011-07-18 23:34 ` Mike Shal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).