Re: How to find commits unique to a branch

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

 



Nikolaus Rath venit, vidit, dixit 21.06.2016 01:21:
> On Jun 20 2016, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> Nikolaus Rath <Nikolaus@xxxxxxxx> writes:
>>
>>> What's the best way to find all commits in a branch A that have not been
>>> cherry-picked from (or to) another branch B?
>>>
>>> I think I could format-patch all commits in every branch into separate
>>> files, hash the Author and Date of each files, and then compare the two
>>> lists. But I'm hoping there's a way to instead have git do the
>>> heavy-lifting?
>>
>> "git cherry" perhaps?
> 
> That seems to work only the "wrong way around". I have a tag
> fuse_3_0_start, which is the common ancestor to "master" and
> "fuse_2_9_bugfix". I'd like to find all the commits from fuse_3_0_start
> to master that have not been cherry-picked into fuse_2_9_bugfix.
> 
> However:
> 
> * "git cherry fuse_3_0_start master release2.9" tells me nothing has
>   been cherry-picked at all (only lines with +)
> 
> * "git cherry fuse_3_0_start release2.9 master" also tells me nothing
>   has been cherry picked, but somehow shows a smaller total number of
>   commits.
> 
> * "git cherry master release2.9 fuse_3_0_start" gives me the commits
>   from fuse_2_9_bugfix that have not been cherry-picked into master
>   (which seems to be in contradiction to the two earlier commands).
> 
> 
> Am I missing something obvious?

There is always

git log --left-right --cherry-mark A...B

to give you a good overview of the situation.

"--cherry-pick" instead of "--cherry-mark" will leave out the
"="-commits (equivalent ones), and the description of "git log --cherry"
in the log man page gives you a good idea of how you can combine
"--cherry-pick" with "--left-only" etc. to give you exactly what you want.

For script-usage, you can finally replace "git log" by "git rev-list"
with the same rev selecting options.

Michael

--
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]