Re: How to find all the commits that comprise a branch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Felipe Contreras <felipe.contreras@xxxxxxxxx> writes:

> Hi,
>
> Basically what I want to do is:
>
>  % git log branch ^<any-other-branch>
>
> IOW; all the commits were 'git branch --contains' would show 'branch'
> and nothing else.
>
> Is there any easy way to do that?

There was "log blah --not --all --exclude-ref=refs/heads/blah"
discussion a few months ago, but I do not think anything came out of
it.

This is a tangent, but it would be a good way to find out set of
commits that you would lose and need to go to reflog to find if you
were to delete the branch.

It however is a poor definition for "commits that comprise a branch";
I actually am not sure if the concept has a sensible definition.

Let's think aloud with a few examples.

You may be done with your "work" branch and merge it to "master".
At that point, do you think you no longer have any commit that
comprises your "work" branch?

You could argue that "work" branch is no longer relevant because it
is part of "master", and it is an understandable viewpoint.

But imagine what happens when you find a bug in your "work" and want
to fix it up by queuing a correction on your "work" branch (not
directly on "master", because your "work" branch was forked from
"maint" and you eventually want to merge it there as well).  Now, is
the single fix-up commit the only commit that comprises your "work"?

Suppose you have 5-patch series in your "work" branch, two commits
at the bottom of which are useful refactoring of existing code.  I
fork from the second commit to take advantage of your refactoring to
work on something entirely different.  These two branches now share
the bottom two commits.  At this point, do you have only three
remaining commits on your "work" branch?  Wouldn't we rather want to
say that I am merely borrowing two commits from you and you still
have 5 commits that is what your "work" branch consists of?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]