{"thread":{"id":"27837","subject":"git show-branch --topics and merge commits","startedAt":"2011-07-17T23:56:26Z","lastAt":"2011-07-18T23:34:59Z","messageCount":5,"participants":["Mike Shal","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171528","messageId":"CA+6x0LWXz-SpnZjdiV3UKJzUz3+0LiMOsbZHTn2gJ+v6bPGndA@mail.gmail.com","threadId":"27837","inReplyTo":null,"subject":"git show-branch --topics and merge commits","fromName":"Mike Shal","fromEmail":"marfey@gmail.com","sentAt":"2011-07-17T23:56:26Z","receivedAt":"2011-07-17T23:56:26Z","isPatch":false,"sender":{"key":"marfey@gmail.com","avatar":null},"body":"Hello,\n\nI'm trying to use 'git show-branch --topics' to list the commits on a\nbranch that are not yet in master. Normally this works fine, but after\nmerging master up to newbranch, it comes up blank (I would expect to\nstill see commits on newbranch that aren't on master). Eg, with a\nhistory like so:\n\n$ git log --graph --oneline\n*   94968cf Merge branch 'master' into newbranch\n|\\\n| * 223c001 more text\n* | 13766bd new\n|/\n* ad878b4 ok\n\n(newbranch on the left, master on the right)\n\nI get the following output from git show-branch:\n\n$ git show-branch --topics master newbranch\n! [master] more text\n * [newbranch] Merge branch 'master' into newbranch\n--\n - [newbranch] Merge branch 'master' into newbranch\n+* [master] more text\n\nI would expect to see the 'new' commit here, since it hasn't been\nmerged to master. The man page for git-show-branch says this should be\nequivalent to 'git rev-list ^master newbranch', but when I run that I\nget the expected output:\n\n$ git rev-list ^master newbranch\n94968cf2753b97481434f0813271659e08811177\n13766bdc28df3841e25c43b53748e37f73fadb9f\n\nSo rev-list shows my merge commit and the 'new' commit, but\nshow-branch --topics doesn't show 'new'. Is this the expected\nbehavior? If so, what is the best way to get a list of changes on a\ntopic branch that periodically has had the master branch merged into\nit?\n\nThanks,\n-Mike\n"},{"id":"171533","messageId":"7v8vrwl46q.fsf@alter.siamese.dyndns.org","threadId":"27837","inReplyTo":"CA+6x0LWXz-SpnZjdiV3UKJzUz3+0LiMOsbZHTn2gJ+v6bPGndA@mail.gmail.com","subject":"Re: git show-branch --topics and merge commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-18T02:21:01Z","receivedAt":"2011-07-18T02:21:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mike Shal <marfey@gmail.com> writes:\n\n> So rev-list shows my merge commit and the 'new' commit, but\n> show-branch --topics doesn't show 'new'. Is this the expected\n> behavior?\n\nYes, show-branch was specifically written for people with strict sense of\nproject hygiene who do not merge into their topic from upstream (which\nwould turn the branch from \"place to hold commits on this topic\" into\n\"place to hold commits on this topic and unrelated random changes made in\nupstream\").\n"},{"id":"171537","messageId":"CA+6x0LXHKZgvW4_hWz8qrWQshqxB3pQ-=08itqnV5smA_NCrBA@mail.gmail.com","threadId":"27837","inReplyTo":"7v8vrwl46q.fsf@alter.siamese.dyndns.org","subject":"Re: git show-branch --topics and merge commits","fromName":"Mike Shal","fromEmail":"marfey@gmail.com","sentAt":"2011-07-18T03:37:47Z","receivedAt":"2011-07-18T03:37:47Z","isPatch":false,"sender":{"key":"marfey@gmail.com","avatar":null},"body":"On Sun, Jul 17, 2011 at 10:21 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Mike Shal <marfey@gmail.com> writes:\n>\n>> So rev-list shows my merge commit and the 'new' commit, but\n>> show-branch --topics doesn't show 'new'. Is this the expected\n>> behavior?\n>\n> Yes, show-branch was specifically written for people with strict sense of\n> project hygiene who do not merge into their topic from upstream (which\n> would turn the branch from \"place to hold commits on this topic\" into\n> \"place to hold commits on this topic and unrelated random changes made in\n> upstream\").\n>\n>\n\nOk, makes sense. Is 'git rev-list' supposed to give the same list of\ncommits then? In my example, rev-list shows the commit on the branch\neven after upstream has been merged in. My confusion comes from this\nline in the man page of git-show-branch:\n\n   When given \"git show-branch --topics master topic1 topic2\", this\nwill show the revisions given by \"git rev-list ^master topic1 topic2\"\n\nThanks again,\n-Mike\n"},{"id":"171597","messageId":"7v4o2jlalx.fsf@alter.siamese.dyndns.org","threadId":"27837","inReplyTo":"CA+6x0LXHKZgvW4_hWz8qrWQshqxB3pQ-=08itqnV5smA_NCrBA@mail.gmail.com","subject":"Re: git show-branch --topics and merge commits","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-07-18T18:14:34Z","receivedAt":"2011-07-18T18:14:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mike Shal <marfey@gmail.com> writes:\n\n> Ok, makes sense. Is 'git rev-list' supposed to give the same list of\n> commits then? In my example, rev-list shows the commit on the branch\n> even after upstream has been merged in.\n\n\"show-branch\" was designed to stop after seeing a commit that are shared\nwith all the branches it was given, so\n\n\tgit show-branch A B\n\nis more like\n\n\tgit rev-list --left-right --boundary A...B\n\nand not at all like\n\n\tgit rev-list A..B\n\nwhich is to show all commits not in A that appear in B.\n\nNote that show-branch was invented way before the log family of commands\n(which rev-list is a member of) learned --left-right/--boundary/--graph\noptions, and I personally think its graphical output mode outlived its\nusefulness as a stopgap measure.  As its \"merge-base\" and \"independent\"\nmodes have also been made redundant (see \"git merge-base\" for two options\nto mimic their behaviour), we may want to start thinking about deprecating\nthe command, and the first step perhaps would be to replace its mention\nfrom the first part of the Everyday Git document with something more\nappropriate such as \"git log\".\n"},{"id":"171615","messageId":"CA+6x0LUD7yQ3DRTvJfP3Y85QPgA1aH40ssiS5+yXu8uDtZxhdA@mail.gmail.com","threadId":"27837","inReplyTo":"7v4o2jlalx.fsf@alter.siamese.dyndns.org","subject":"Re: git show-branch --topics and merge commits","fromName":"Mike Shal","fromEmail":"marfey@gmail.com","sentAt":"2011-07-18T23:34:59Z","receivedAt":"2011-07-18T23:34:59Z","isPatch":false,"sender":{"key":"marfey@gmail.com","avatar":null},"body":"On Mon, Jul 18, 2011 at 2:14 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Note that show-branch was invented way before the log family of commands\n> (which rev-list is a member of) learned --left-right/--boundary/--graph\n> options, and I personally think its graphical output mode outlived its\n> usefulness as a stopgap measure.  As its \"merge-base\" and \"independent\"\n> modes have also been made redundant (see \"git merge-base\" for two options\n> to mimic their behaviour), we may want to start thinking about deprecating\n> the command, and the first step perhaps would be to replace its mention\n> from the first part of the Everyday Git document with something more\n> appropriate such as \"git log\".\n\nHmm I had no idea 'git log' was so powerful. I'll be using that from\nnow on instead of show-branch --topics :)\n\nThanks for your detailed response,\n-Mike\n"}]}