Re: Question about git log --merge option

2016-04-13 Thread Andrey Hsiao
Thanks Junio, I understand the option's meaning now :)

On Thu, Apr 14, 2016 at 4:37 AM, Junio C Hamano  wrote:
> Andrey Hsiao  writes:
>
>> Dear list:
>>
>> Just encountered the --merge option for git log.
>>
>> In the man page, it has the following explanation:
>> - After a failed merge, show refs that touch files having a conflict
>> and don't exist on all heads to merge.
>
> git log --merge [options] -- $paths
>
> is roughly the same as
>
> git log [options] HEAD...MERGE_HEAD -- $paths'
>
> where $paths' is $paths limited to those with conflicts.  You can
> further think of that as a rough equivalent of
>
> git log [options] ^X HEAD MERGE_HEAD -- $paths'
>
> where X is the merge base between the tips of these two branches:
>
> X---o---o---o---H
>  \
>   o---o---o---M
>
> And the commits among these ('o's, H and M in the picture), the ones
> that change any of the $paths' are shown.  If you further limit the
> output (e.g. with -n, or --since=), you may not see all of
> them, of course.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about git log --merge option

2016-04-13 Thread Junio C Hamano
Andrey Hsiao  writes:

> Dear list:
>
> Just encountered the --merge option for git log.
>
> In the man page, it has the following explanation:
> - After a failed merge, show refs that touch files having a conflict
> and don't exist on all heads to merge.

git log --merge [options] -- $paths

is roughly the same as

git log [options] HEAD...MERGE_HEAD -- $paths'

where $paths' is $paths limited to those with conflicts.  You can
further think of that as a rough equivalent of

git log [options] ^X HEAD MERGE_HEAD -- $paths'

where X is the merge base between the tips of these two branches:

X---o---o---o---H
 \
  o---o---o---M

And the commits among these ('o's, H and M in the picture), the ones
that change any of the $paths' are shown.  If you further limit the
output (e.g. with -n, or --since=), you may not see all of
them, of course.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Question about git log --merge option

2016-04-13 Thread Andrey Hsiao
Dear list:

Just encountered the --merge option for git log.

In the man page, it has the following explanation:
- After a failed merge, show refs that touch files having a conflict
and don't exist on all heads to merge.

I tried this option and get below results:

1. For a failed merge (with conflicts), if the conflicted file does
not exist on either side of the merge, the --merge option will return
the log from the other side.

2. If the conflicted file exists on both sides of the merge, the
--merge option will return the latest change on either side. (i.e: git
log -1 -- conflict_file / git log -1 --merge -- conflict_file may
return different results, whichever changed the latest)

I'm not sure whether above behavior is the unexpected result (cannot
find detailed explanation for --merge option online).

Thanks
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: About git log

2015-04-24 Thread Kevin Daudt
On Mon, Apr 06, 2015 at 10:21:37PM +0800, niu2x wrote:
> I'm a beginner.
> Please tell me the log of git commit is exist forever or 90 days

As long as a commit is (indirectly) referenced by a branch or tag, it will
be kept forever. Only if you rewrite history causing commits to be
unreferenced (for example, by using git reset --hard), the commits will be
eventually removed.

The 90 days you might have heard of, refers to the time the reflog keeps
reference to commits so that you can find them back in case you
accidentally caused the commit to be unreferenced.

Entries in the reflog will expire after 90 days, after which no reference
to the commits remain, and the garbage collector will remove those commits.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


About git log

2015-04-06 Thread niu2x
I'm a beginner.
Please tell me the log of git commit is exist forever or 90 days

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-27 Thread Francis Moreau
On Fri, Sep 27, 2013 at 11:14 AM, John Keeping  wrote:
> On Fri, Sep 27, 2013 at 10:28:05AM +0200, Francis Moreau wrote:
>> On Fri, Sep 27, 2013 at 10:11 AM, John Keeping  wrote:
>> > On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
>> >> Hi,
>> >>
>> >> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping  wrote:
>> >> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> >> >> I'm trying to use "git log --cherry ..." in order to display new, kept
>> >> >> and removed commits between two branches A and B.
>> >> >>
>> >> >> So commits which are only in B are considered new and should be marked
>> >> >> with '+'. Commits which are in both branches are marked with '=' but
>> >> >> only commit in branch B are shown. Eventually commits which are in A
>> >> >> but not in B anymore should be marked with '-'.
>> >> >>
>> >> >> So far I found this solution:
>> >> >>
>> >> >>   $ git log --cherry-mark --right-only A...B
>> >> >>   $ git log --cherry-pick  --left-only   A...B
>> >> >>
>> >> >> but I have to call twice git-log. This can be annoying since depending
>> >> >> on A and B, calling git-log can take time.
>> >> >>
>> >> >> Is there another option that I'm missing which would do the job but
>> >> >> with only one call to git-log ?
>> >> >
>> >> > Does this do what you want?
>> >> >
>> >> > git log --cherry-mark --left-right A...B |
>> >> > sed -e '/^commit / {
>> >> > y/<>/-+/
>> >> > }'
>> >>
>> >> Nope because --left-right shows common commits (with '=' mark) that
>> >> belong to A *and* B, and I'd like to have only the ones in B.
>> >
>> > I think the only way you can address this is to post-process the result,
>> > I don't know any way to remove a left side commit only if it is
>> > patch-identical to a right side commit.
>> >
>> > It should be relatively easy to filter out any '=' commits that are in
>> > the output of "git rev-list --left-only A...B".
>>
>> yes that's what I'm doing but I was wondering if that's possible to do
>> that with only one run of git-log/git-rev-list.
>
> I don't think it is.  But you only need to use the --cherry-mark option
> with one of the runs, so the other one should be very quick - the added
> work of calculating patch IDs slows down "git log" a lot.

That's true, rev-list should be way faster. I think I'll do that.

Thanks.
-- 
Francis
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-27 Thread John Keeping
On Fri, Sep 27, 2013 at 10:28:05AM +0200, Francis Moreau wrote:
> On Fri, Sep 27, 2013 at 10:11 AM, John Keeping  wrote:
> > On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
> >> Hi,
> >>
> >> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping  wrote:
> >> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> >> >> I'm trying to use "git log --cherry ..." in order to display new, kept
> >> >> and removed commits between two branches A and B.
> >> >>
> >> >> So commits which are only in B are considered new and should be marked
> >> >> with '+'. Commits which are in both branches are marked with '=' but
> >> >> only commit in branch B are shown. Eventually commits which are in A
> >> >> but not in B anymore should be marked with '-'.
> >> >>
> >> >> So far I found this solution:
> >> >>
> >> >>   $ git log --cherry-mark --right-only A...B
> >> >>   $ git log --cherry-pick  --left-only   A...B
> >> >>
> >> >> but I have to call twice git-log. This can be annoying since depending
> >> >> on A and B, calling git-log can take time.
> >> >>
> >> >> Is there another option that I'm missing which would do the job but
> >> >> with only one call to git-log ?
> >> >
> >> > Does this do what you want?
> >> >
> >> > git log --cherry-mark --left-right A...B |
> >> > sed -e '/^commit / {
> >> > y/<>/-+/
> >> > }'
> >>
> >> Nope because --left-right shows common commits (with '=' mark) that
> >> belong to A *and* B, and I'd like to have only the ones in B.
> >
> > I think the only way you can address this is to post-process the result,
> > I don't know any way to remove a left side commit only if it is
> > patch-identical to a right side commit.
> >
> > It should be relatively easy to filter out any '=' commits that are in
> > the output of "git rev-list --left-only A...B".
> 
> yes that's what I'm doing but I was wondering if that's possible to do
> that with only one run of git-log/git-rev-list.

I don't think it is.  But you only need to use the --cherry-mark option
with one of the runs, so the other one should be very quick - the added
work of calculating patch IDs slows down "git log" a lot.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-27 Thread Francis Moreau
On Fri, Sep 27, 2013 at 10:11 AM, John Keeping  wrote:
> On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
>> Hi,
>>
>> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping  wrote:
>> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> >> I'm trying to use "git log --cherry ..." in order to display new, kept
>> >> and removed commits between two branches A and B.
>> >>
>> >> So commits which are only in B are considered new and should be marked
>> >> with '+'. Commits which are in both branches are marked with '=' but
>> >> only commit in branch B are shown. Eventually commits which are in A
>> >> but not in B anymore should be marked with '-'.
>> >>
>> >> So far I found this solution:
>> >>
>> >>   $ git log --cherry-mark --right-only A...B
>> >>   $ git log --cherry-pick  --left-only   A...B
>> >>
>> >> but I have to call twice git-log. This can be annoying since depending
>> >> on A and B, calling git-log can take time.
>> >>
>> >> Is there another option that I'm missing which would do the job but
>> >> with only one call to git-log ?
>> >
>> > Does this do what you want?
>> >
>> > git log --cherry-mark --left-right A...B |
>> > sed -e '/^commit / {
>> > y/<>/-+/
>> > }'
>>
>> Nope because --left-right shows common commits (with '=' mark) that
>> belong to A *and* B, and I'd like to have only the ones in B.
>
> I think the only way you can address this is to post-process the result,
> I don't know any way to remove a left side commit only if it is
> patch-identical to a right side commit.
>
> It should be relatively easy to filter out any '=' commits that are in
> the output of "git rev-list --left-only A...B".

yes that's what I'm doing but I was wondering if that's possible to do
that with only one run of git-log/git-rev-list.

Thanks
-- 
Francis
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-27 Thread John Keeping
On Fri, Sep 27, 2013 at 07:09:03AM +0200, Francis Moreau wrote:
> Hi,
> 
> On Thu, Sep 26, 2013 at 10:21 PM, John Keeping  wrote:
> > On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> >> I'm trying to use "git log --cherry ..." in order to display new, kept
> >> and removed commits between two branches A and B.
> >>
> >> So commits which are only in B are considered new and should be marked
> >> with '+'. Commits which are in both branches are marked with '=' but
> >> only commit in branch B are shown. Eventually commits which are in A
> >> but not in B anymore should be marked with '-'.
> >>
> >> So far I found this solution:
> >>
> >>   $ git log --cherry-mark --right-only A...B
> >>   $ git log --cherry-pick  --left-only   A...B
> >>
> >> but I have to call twice git-log. This can be annoying since depending
> >> on A and B, calling git-log can take time.
> >>
> >> Is there another option that I'm missing which would do the job but
> >> with only one call to git-log ?
> >
> > Does this do what you want?
> >
> > git log --cherry-mark --left-right A...B |
> > sed -e '/^commit / {
> > y/<>/-+/
> > }'
> 
> Nope because --left-right shows common commits (with '=' mark) that
> belong to A *and* B, and I'd like to have only the ones in B.

I think the only way you can address this is to post-process the result,
I don't know any way to remove a left side commit only if it is
patch-identical to a right side commit.

It should be relatively easy to filter out any '=' commits that are in
the output of "git rev-list --left-only A...B".
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-26 Thread Francis Moreau
Hi,

On Thu, Sep 26, 2013 at 10:21 PM, John Keeping  wrote:
> On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
>> I'm trying to use "git log --cherry ..." in order to display new, kept
>> and removed commits between two branches A and B.
>>
>> So commits which are only in B are considered new and should be marked
>> with '+'. Commits which are in both branches are marked with '=' but
>> only commit in branch B are shown. Eventually commits which are in A
>> but not in B anymore should be marked with '-'.
>>
>> So far I found this solution:
>>
>>   $ git log --cherry-mark --right-only A...B
>>   $ git log --cherry-pick  --left-only   A...B
>>
>> but I have to call twice git-log. This can be annoying since depending
>> on A and B, calling git-log can take time.
>>
>> Is there another option that I'm missing which would do the job but
>> with only one call to git-log ?
>
> Does this do what you want?
>
> git log --cherry-mark --left-right A...B |
> sed -e '/^commit / {
> y/<>/-+/
> }'

Nope because --left-right shows common commits (with '=' mark) that
belong to A *and* B, and I'd like to have only the ones in B.

Thanks
-- 
Francis
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question about "git log --cherry"

2013-09-26 Thread John Keeping
On Thu, Sep 26, 2013 at 06:35:57PM +0200, Francis Moreau wrote:
> I'm trying to use "git log --cherry ..." in order to display new, kept
> and removed commits between two branches A and B.
> 
> So commits which are only in B are considered new and should be marked
> with '+'. Commits which are in both branches are marked with '=' but
> only commit in branch B are shown. Eventually commits which are in A
> but not in B anymore should be marked with '-'.
> 
> So far I found this solution:
> 
>   $ git log --cherry-mark --right-only A...B
>   $ git log --cherry-pick  --left-only   A...B
> 
> but I have to call twice git-log. This can be annoying since depending
> on A and B, calling git-log can take time.
> 
> Is there another option that I'm missing which would do the job but
> with only one call to git-log ?

Does this do what you want?

git log --cherry-mark --left-right A...B |
sed -e '/^commit / {
y/<>/-+/
}'
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Question about "git log --cherry"

2013-09-26 Thread Francis Moreau
Hello,

I'm trying to use "git log --cherry ..." in order to display new, kept
and removed commits between two branches A and B.

So commits which are only in B are considered new and should be marked
with '+'. Commits which are in both branches are marked with '=' but
only commit in branch B are shown. Eventually commits which are in A
but not in B anymore should be marked with '-'.

So far I found this solution:

  $ git log --cherry-mark --right-only A...B
  $ git log --cherry-pick  --left-only   A...B

but I have to call twice git-log. This can be annoying since depending
on A and B, calling git-log can take time.

Is there another option that I'm missing which would do the job but
with only one call to git-log ?

Thanks
-- 
Francis
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html