* help with git query
@ 2009-04-13 18:51 E R
2009-04-13 20:31 ` Nathan W. Panike
0 siblings, 1 reply; 6+ messages in thread
From: E R @ 2009-04-13 18:51 UTC (permalink / raw)
To: git
Hi,
I'd like to generate the following report from git:
for each branch:
- info about the latest commit on that branch (date and time, message, etc.)
- info about the last time it was merged into master
What commands can I run to figure this out? I think I can figure out
the first one - it's the second one I'm having trouble with.
And if it would easier to do it from the C API (or something like the
perl Git::PurePerl module) I'd be interested in knowing that, too.
Thanks,
ER
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: help with git query
2009-04-13 18:51 help with git query E R
@ 2009-04-13 20:31 ` Nathan W. Panike
2009-04-13 20:57 ` E R
2009-04-14 5:46 ` Jeff King
0 siblings, 2 replies; 6+ messages in thread
From: Nathan W. Panike @ 2009-04-13 20:31 UTC (permalink / raw)
To: E R; +Cc: git
On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:
> Hi,
>
> I'd like to generate the following report from git:
>
> for each branch:
> - info about the latest commit on that branch (date and time, message, etc.)
Depending on what you want to do---from a bash shell, you could do:
for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
> - info about the last time it was merged into master
for i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git
merge-base $i master); echo; done
>
> What commands can I run to figure this out? I think I can figure out
> the first one - it's the second one I'm having trouble with.
>
> And if it would easier to do it from the C API (or something like the
> perl Git::PurePerl module) I'd be interested in knowing that, too.
>
> Thanks,
> ER
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: help with git query
2009-04-13 20:31 ` Nathan W. Panike
@ 2009-04-13 20:57 ` E R
2009-04-13 22:33 ` Nathan W. Panike
2009-04-14 5:46 ` Jeff King
1 sibling, 1 reply; 6+ messages in thread
From: E R @ 2009-04-13 20:57 UTC (permalink / raw)
To: Nathan W. Panike; +Cc: git
Thanks - that's very helpful.
For the second question, is it possible to find the commit that
represents the merge in the master branch?
i.e.
git merge-base XXX master
returns the commit in branch XXX that got merged into master. I'd like
to also find the commit that represents the merge in master.
On Mon, Apr 13, 2009 at 3:31 PM, Nathan W. Panike
<nathan.panike@gmail.com> wrote:
> On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:
>> Hi,
>>
>> I'd like to generate the following report from git:
>>
>> for each branch:
>> - info about the latest commit on that branch (date and time, message, etc.)
>
> Depending on what you want to do---from a bash shell, you could do:
>
> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
>
>> - info about the last time it was merged into master
>
> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git
> merge-base $i master); echo; done
>>
>> What commands can I run to figure this out? I think I can figure out
>> the first one - it's the second one I'm having trouble with.
>>
>> And if it would easier to do it from the C API (or something like the
>> perl Git::PurePerl module) I'd be interested in knowing that, too.
>>
>> Thanks,
>> ER
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: help with git query
2009-04-13 20:57 ` E R
@ 2009-04-13 22:33 ` Nathan W. Panike
0 siblings, 0 replies; 6+ messages in thread
From: Nathan W. Panike @ 2009-04-13 22:33 UTC (permalink / raw)
To: E R; +Cc: git
On Mon, Apr 13, 2009 at 3:57 PM, E R <pc88mxer@gmail.com> wrote:
> Thanks - that's very helpful.
>
> For the second question, is it possible to find the commit that
> represents the merge in the master branch?
There might not be an actual commit, if the merge was a fast forward.
>
> i.e.
>
> git merge-base XXX master
>
> returns the commit in branch XXX that got merged into master. I'd like
> to also find the commit that represents the merge in master.
If one exists, I think this might do what you want:
git log --pretty=oneline master --not $(git merge-base XXX master) | tail -1
> On Mon, Apr 13, 2009 at 3:31 PM, Nathan W. Panike
> <nathan.panike@gmail.com> wrote:
>> On Mon, Apr 13, 2009 at 1:51 PM, E R <pc88mxer@gmail.com> wrote:
>>> Hi,
>>>
>>> I'd like to generate the following report from git:
>>>
>>> for each branch:
>>> - info about the latest commit on that branch (date and time, message, etc.)
>>
>> Depending on what you want to do---from a bash shell, you could do:
>>
>> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
>>
>>> - info about the last time it was merged into master
>>
>> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $(git
>> merge-base $i master); echo; done
>>>
>>> What commands can I run to figure this out? I think I can figure out
>>> the first one - it's the second one I'm having trouble with.
>>>
>>> And if it would easier to do it from the C API (or something like the
>>> perl Git::PurePerl module) I'd be interested in knowing that, too.
>>>
>>> Thanks,
>>> ER
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe git" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: help with git query
2009-04-13 20:31 ` Nathan W. Panike
2009-04-13 20:57 ` E R
@ 2009-04-14 5:46 ` Jeff King
2009-04-14 6:26 ` Björn Steinbrink
1 sibling, 1 reply; 6+ messages in thread
From: Jeff King @ 2009-04-14 5:46 UTC (permalink / raw)
To: Nathan W. Panike; +Cc: E R, git
On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:
> > for each branch:
> > - info about the latest commit on that branch (date and time, message, etc.)
>
> Depending on what you want to do---from a bash shell, you could do:
>
> for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
Ick, please use the plumbing designed for this exact thing instead of
trying to parse "git branch":
$ git for-each-ref --format='%(subject)
%(authorname) %(authoremail)
%(authordate)' refs/heads/
or however you want to format it. See "git help for-each-ref" for a list
of fields (you can also just pipe the output of for-each-ref into a
shell loop, as in your example, but with the format options there is
often no need).
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: help with git query
2009-04-14 5:46 ` Jeff King
@ 2009-04-14 6:26 ` Björn Steinbrink
0 siblings, 0 replies; 6+ messages in thread
From: Björn Steinbrink @ 2009-04-14 6:26 UTC (permalink / raw)
To: Jeff King; +Cc: Nathan W. Panike, E R, git
On 2009.04.14 01:46:54 -0400, Jeff King wrote:
> On Mon, Apr 13, 2009 at 03:31:49PM -0500, Nathan W. Panike wrote:
>
> > > for each branch:
> > > - info about the latest commit on that branch (date and time, message, etc.)
> >
> > Depending on what you want to do---from a bash shell, you could do:
> >
> > for i in $(git branch -a | cut -b3-); do echo $i; git show -s $i; echo; done
>
> Ick, please use the plumbing designed for this exact thing instead of
> trying to parse "git branch":
>
> $ git for-each-ref --format='%(subject)
> %(authorname) %(authoremail)
> %(authordate)' refs/heads/
>
> or however you want to format it. See "git help for-each-ref" for a list
> of fields (you can also just pipe the output of for-each-ref into a
> shell loop, as in your example, but with the format options there is
> often no need).
git log --no-walk --branches --decorate --pretty=short
is what I use, sometimes. Some other "pretty" format might be more
suitable for your use case.
Björn
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-14 6:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-13 18:51 help with git query E R
2009-04-13 20:31 ` Nathan W. Panike
2009-04-13 20:57 ` E R
2009-04-13 22:33 ` Nathan W. Panike
2009-04-14 5:46 ` Jeff King
2009-04-14 6:26 ` Björn Steinbrink
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).