{"thread":{"id":"18853","subject":"help with git query","startedAt":"2009-04-13T18:51:25Z","lastAt":"2009-04-14T06:26:52Z","messageCount":6,"participants":["E R","Nathan W. Panike","Jeff King","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"111225","messageId":"3a69fa7c0904131151p35945ed3y58cba069bd801337@mail.gmail.com","threadId":"18853","inReplyTo":null,"subject":"help with git query","fromName":"E R","fromEmail":"pc88mxer@gmail.com","sentAt":"2009-04-13T18:51:25Z","receivedAt":"2009-04-13T18:51:25Z","isPatch":false,"sender":{"key":"pc88mxer@gmail.com","avatar":null},"body":"Hi,\n\nI'd like to generate the following report from git:\n\nfor each branch:\n  - info about the latest commit on that branch (date and time, message, etc.)\n  - info about the last time it was merged into master\n\nWhat commands can I run to figure this out? I think I can figure out\nthe first one - it's the second one I'm having trouble with.\n\nAnd if it would easier to do it from the C API (or something like the\nperl Git::PurePerl module) I'd be interested in knowing that, too.\n\nThanks,\nER\n"},{"id":"111230","messageId":"d77df1110904131331p24f52220o74c401c97fbb904d@mail.gmail.com","threadId":"18853","inReplyTo":"3a69fa7c0904131151p35945ed3y58cba069bd801337@mail.gmail.com","subject":"Re: help with git query","fromName":"Nathan W. Panike","fromEmail":"nathan.panike@gmail.com","sentAt":"2009-04-13T20:31:49Z","receivedAt":"2009-04-13T20:31:49Z","isPatch":false,"sender":{"key":"nathan.panike@gmail.com","avatar":"https://avatars.githubusercontent.com/u/389447?v=4"},"body":"On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:\n> Hi,\n>\n> I'd like to generate the following report from git:\n>\n> for each branch:\n>  - info about the latest commit on that branch (date and time, message, etc.)\n\nDepending on what you want to do---from a bash shell, you could do:\n\nfor i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done\n\n>  - info about the last time it was merged into master\n\nfor i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git\nmerge-base $i master); echo; done\n>\n> What commands can I run to figure this out? I think I can figure out\n> the first one - it's the second one I'm having trouble with.\n>\n> And if it would easier to do it from the C API (or something like the\n> perl Git::PurePerl module) I'd be interested in knowing that, too.\n>\n> Thanks,\n> ER\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"111235","messageId":"3a69fa7c0904131357w5ef6b8feu7aac503fdcc4486c@mail.gmail.com","threadId":"18853","inReplyTo":"d77df1110904131331p24f52220o74c401c97fbb904d@mail.gmail.com","subject":"Re: help with git query","fromName":"E R","fromEmail":"pc88mxer@gmail.com","sentAt":"2009-04-13T20:57:26Z","receivedAt":"2009-04-13T20:57:26Z","isPatch":false,"sender":{"key":"pc88mxer@gmail.com","avatar":null},"body":"Thanks - that's very helpful.\n\nFor the second question, is it possible to find the commit that\nrepresents the merge in the master branch?\n\ni.e.\n\n   git merge-base XXX master\n\nreturns the commit in branch XXX that got merged into master. I'd like\nto also find the commit that represents the merge in master.\n\nOn Mon, Apr 13, 2009 at 3:31 PM, Nathan W. Panike\n<nathan.panike@gmail.com> wrote:\n> On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:\n>> Hi,\n>>\n>> I'd like to generate the following report from git:\n>>\n>> for each branch:\n>>  - info about the latest commit on that branch (date and time, message, etc.)\n>\n> Depending on what you want to do---from a bash shell, you could do:\n>\n> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done\n>\n>>  - info about the last time it was merged into master\n>\n> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git\n> merge-base $i master); echo; done\n>>\n>> What commands can I run to figure this out? I think I can figure out\n>> the first one - it's the second one I'm having trouble with.\n>>\n>> And if it would easier to do it from the C API (or something like the\n>> perl Git::PurePerl module) I'd be interested in knowing that, too.\n>>\n>> Thanks,\n>> ER\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>\n>\n"},{"id":"111243","messageId":"d77df1110904131533y46234255qc0ec533ee583df95@mail.gmail.com","threadId":"18853","inReplyTo":"3a69fa7c0904131357w5ef6b8feu7aac503fdcc4486c@mail.gmail.com","subject":"Re: help with git query","fromName":"Nathan W. Panike","fromEmail":"nathan.panike@gmail.com","sentAt":"2009-04-13T22:33:25Z","receivedAt":"2009-04-13T22:33:25Z","isPatch":false,"sender":{"key":"nathan.panike@gmail.com","avatar":"https://avatars.githubusercontent.com/u/389447?v=4"},"body":"On Mon, Apr 13, 2009 at 3:57 PM, E R <pc88mxer@gmail.com> wrote:\n> Thanks - that's very helpful.\n>\n> For the second question, is it possible to find the commit that\n> represents the merge in the master branch?\n\nThere might not be an actual commit, if the merge was a fast forward.\n\n>\n> i.e.\n>\n>   git merge-base XXX master\n>\n> returns the commit in branch XXX that got merged into master. I'd like\n> to also find the commit that represents the merge in master.\n\nIf one exists, I think this might do what you want:\n\ngit log --pretty=oneline master --not $(git merge-base XXX master) | tail -1\n\n> On Mon, Apr 13, 2009 at 3:31 PM, Nathan W. Panike\n> <nathan.panike@gmail.com> wrote:\n>> On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:\n>>> Hi,\n>>>\n>>> I'd like to generate the following report from git:\n>>>\n>>> for each branch:\n>>>  - info about the latest commit on that branch (date and time, message, etc.)\n>>\n>> Depending on what you want to do---from a bash shell, you could do:\n>>\n>> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done\n>>\n>>>  - info about the last time it was merged into master\n>>\n>> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git\n>> merge-base $i master); echo; done\n>>>\n>>> What commands can I run to figure this out? I think I can figure out\n>>> the first one - it's the second one I'm having trouble with.\n>>>\n>>> And if it would easier to do it from the C API (or something like the\n>>> perl Git::PurePerl module) I'd be interested in knowing that, too.\n>>>\n>>> Thanks,\n>>> ER\n>>> --\n>>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>>> the body of a message to majordomo@vger.kernel.org\n>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>>>\n>>\n>\n"},{"id":"111264","messageId":"20090414054654.GC19027@coredump.intra.peff.net","threadId":"18853","inReplyTo":"d77df1110904131331p24f52220o74c401c97fbb904d@mail.gmail.com","subject":"Re: help with git query","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-04-14T05:46:54Z","receivedAt":"2009-04-14T05:46:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:\n\n> > for each branch:\n> >  - info about the latest commit on that branch (date and time, message, etc.)\n> \n> Depending on what you want to do---from a bash shell, you could do:\n> \n> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done\n\nIck, please use the plumbing designed for this exact thing instead of\ntrying to parse \"git branch\":\n\n  $ git for-each-ref --format='%(subject)\n    %(authorname) %(authoremail)\n    %(authordate)' refs/heads/\n\nor however you want to format it. See \"git help for-each-ref\" for a list\nof fields (you can also just pipe the output of for-each-ref into a\nshell loop, as in your example, but with the format options there is\noften no need).\n\n-Peff\n"},{"id":"111269","messageId":"20090414062652.GC3948@atjola.homenet","threadId":"18853","inReplyTo":"20090414054654.GC19027@coredump.intra.peff.net","subject":"Re: help with git query","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-04-14T06:26:52Z","receivedAt":"2009-04-14T06:26:52Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.04.14 01:46:54 -0400, Jeff King wrote:\n> On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:\n> \n> > > for each branch:\n> > >  - info about the latest commit on that branch (date and time, message, etc.)\n> > \n> > Depending on what you want to do---from a bash shell, you could do:\n> > \n> > for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done\n> \n> Ick, please use the plumbing designed for this exact thing instead of\n> trying to parse \"git branch\":\n> \n>   $ git for-each-ref --format='%(subject)\n>     %(authorname) %(authoremail)\n>     %(authordate)' refs/heads/\n> \n> or however you want to format it. See \"git help for-each-ref\" for a list\n> of fields (you can also just pipe the output of for-each-ref into a\n> shell loop, as in your example, but with the format options there is\n> often no need).\n\ngit log --no-walk --branches --decorate --pretty=short\n\nis what I use, sometimes. Some other \"pretty\" format might be more\nsuitable for your use case.\n\nBjörn\n"}]}