{"thread":{"id":"45159","subject":"`git show --oneline commit` does not do what's intuitively expected","startedAt":"2017-02-17T01:52:24Z","lastAt":"2017-02-22T17:18:38Z","messageCount":3,"participants":["Luna Kid","Jeff King","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"311834","messageId":"CA+-W3ctdRtLpziJ9TX2hqk7RagMyJpHsrfwj=rN7oXQ8EeUPnw@mail.gmail.com","threadId":"45159","inReplyTo":null,"subject":"`git show --oneline commit` does not do what's intuitively expected","fromName":"Luna Kid","fromEmail":"lunakid@gmail.com","sentAt":"2017-02-17T01:51:36Z","receivedAt":"2017-02-17T01:52:24Z","isPatch":false,"sender":{"key":"lunakid@gmail.com","avatar":null},"body":"Hello,\n\ntl;dr; --> Please add --no-diff (or --msg-only) to git show. We'll\nlove you for that. :)\n\nExpanded:\n\n(I've been a casual git user for 2-3 years; \"casual\" means using a\nsmall subset, nowadays daily, with some less trivial things at times,\nlike per-commit patching for post-hoc auto-versioning, or\npush-deploying (the old way), so not 100% newbie; doing SW for 25+\nyears. I'm telling this, because I'm probably a representative sample\nof a huge number of experienced professionals, who are relatively new\nto git (compared to their age...), but already routinely use it in\n\"survival mode\", learning it gradually, on-demand.)\n\nToday I bumped into this issue, which I then tried googling for, and\nfound it kinda' hanging:\nhttp://stackoverflow.com/questions/17226117/git-show-commit-oneline-not-showing-oneline\n\nThe source of the confusion is that git show --oneline insists on\nshowing the diff, no matter what, while the man page is misleadingly\nsubtle on that, as illustrated best by a comment on that SO page,\nexactly matching my case, too:\n\n    \"the answer does not however explain why git show HEAD --oneline\n    does not produce an output as stated in the documentation:\n    <sha1> <title line> This is designed to be as compact as possible.\"\n\nNote: I do understand now (after 5-10 minutes of googling in vain,\nmucking around with git, re-reading the man page a few times, and\nconsidering the fact that a bug like that in such a feature couldn't\nexist for this long -- in fact, this clue helped me more than the docs\n+ googling together), that it's indeed, not a bug, but our lack of\nintimate familiarity with git and the terseness/wording of the man\npage together cause the confusion.\n\n(BTW, just realized: on the git show man page, also the strangely\nimplied \"log of a commit\" concept (i.e. in \"Pretty-print the contents\nof the commit logs\") is partly responsible for the confusion. The term\n\"log\" doesn't mean a single event-like item, but a series of entries,\na running record of events. In VCS lingo the established concept is\nthat \"a log is a list of commits\", and that's even the case with git,\ntoo, of course. So, readers of the git show man page will have an\nimpedance match there, and unnecessary difficulties understanding what\nis actually going on. My overloaded brain, for example, apparently\nopted for just filtering out that part without warning, upon the first\n(two) reading.)\n\nAssuming that we (the SO guy + his upvoters + me) are not the only\nones, I'd suggest that instead of perhaps changing the man page,\nthere's an other easy, also backwardly compatible, and quite\nstraightforward way to address this: actually implementing that\n\"unexpectedly missing\" feature people intuitively look for.\n\nPlease note that \"show\" is such a profoundly generic command verb,\nprobably also used heavily in git, especially to show commits, that it\ncomes to mind as second nature, without thinking, as the primary (or\neven as \"the only\") choice for showing various items in various ways\n-- which, in fact, it already properly does, indeed.\n\nForcing us to use a different command (git log) for a minor sub-case\nof the main \"show me a commit\" scenario (of git show), is highly\nunnatural.\n\nAlso, --oneline (as all the other formatting options) look and feel\nglobal to the entire context (result) of the show command, so people\nwho have not yet unlearned to expect that, will be surprised\n(unpleasantly).\n\nHowever, simply adding --no-diff to the git show command (and the man\npage) would help a lot. (Something like --message-only or --only-msg\netc., would be more correct (than the \"potentially leaky\" complement),\nbut I'm not familiar with the general use of the \"only\" modifier in\ngit options and cannot comment on that, but I've certainly seen the\n--no-... form at least.)\n\nThanks a lot, and have a nice next message! :)\nSzabolcs\n"},{"id":"311839","messageId":"20170217040522.jugt4uuak74l3qjw@sigill.intra.peff.net","threadId":"45159","inReplyTo":"CA+-W3ctdRtLpziJ9TX2hqk7RagMyJpHsrfwj=rN7oXQ8EeUPnw@mail.gmail.com","subject":"Re: `git show --oneline commit` does not do what's intuitively expected","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-02-17T04:05:22Z","receivedAt":"2017-02-17T04:05:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 17, 2017 at 02:51:36AM +0100, Luna Kid wrote:\n\n> tl;dr; --> Please add --no-diff (or --msg-only) to git show. We'll\n> love you for that. :)\n\nI think it is already spelled \"--no-patch\", or \"-s\" for short.\n\n> Please note that \"show\" is such a profoundly generic command verb,\n> probably also used heavily in git, especially to show commits, that it\n> comes to mind as second nature, without thinking, as the primary (or\n> even as \"the only\") choice for showing various items in various ways\n> -- which, in fact, it already properly does, indeed.\n\nRight. That's what's it for. The DESCRIPTION section of the manpage\nstarts with:\n\n       Shows one or more objects (blobs, trees, tags and commits).\n\n       For commits it shows the log message and textual diff. It also\n       presents the merge commit in a special format as produced by git\n       diff-tree --cc.\n\n       For tags, it shows[...etc...]\n\nI guess that second paragraph could mention \"--no-patch\" explicitly to\ndisable it. It's documented in the COMMON DIFF OPTIONS section, but of\ncourse there are quite a few options listed, so it's easy to miss.\n\n-Peff\n"},{"id":"312315","messageId":"CAADWXX_S8RWE7pSZ-2JM_JeNT7LfHFgEopt6SUUUQYx0yumojw@mail.gmail.com","threadId":"45159","inReplyTo":"20170217040522.jugt4uuak74l3qjw@sigill.intra.peff.net","subject":"Re: `git show --oneline commit` does not do what's intuitively expected","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2017-02-22T17:18:33Z","receivedAt":"2017-02-22T17:18:38Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"On Thu, Feb 16, 2017 at 8:05 PM, Jeff King <peff@peff.net> wrote:\n> On Fri, Feb 17, 2017 at 02:51:36AM +0100, Luna Kid wrote:\n>\n>> tl;dr; --> Please add --no-diff (or --msg-only) to git show. We'll\n>> love you for that. :)\n>\n> I think it is already spelled \"--no-patch\", or \"-s\" for short.\n\nI think people should also learn about \"--no-walk\" (or the numberic\nwalk limiters) to the revision walking logic, because it can often be\nuseful.\n\nIOW, if you only want the commit info, you can certainly use \"git show\n-s\", but you can also use\n\n    git log --no-walk .. list of commits ..\n\nor\n\n    git log -1 <single-commit>\n\nto show a commit without any other details.\n\nBasically, \"git show\" for a commit does what is mostly equivalent to\n\n     git log --cc --no-walk\n\nalthough \"git show\" then has other features too (ie it shows non-commits etc).\n\n                Linus\n"}]}