* How to find commits unique to a branch @ 2016-06-20 20:43 Nikolaus Rath 2016-06-20 22:21 ` Junio C Hamano 0 siblings, 1 reply; 9+ messages in thread From: Nikolaus Rath @ 2016-06-20 20:43 UTC (permalink / raw) To: git Hello, 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? Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-20 20:43 How to find commits unique to a branch Nikolaus Rath @ 2016-06-20 22:21 ` Junio C Hamano 2016-06-20 23:21 ` Nikolaus Rath 0 siblings, 1 reply; 9+ messages in thread From: Junio C Hamano @ 2016-06-20 22:21 UTC (permalink / raw) To: Nikolaus Rath; +Cc: git Nikolaus Rath <Nikolaus@rath.org> 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? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-20 22:21 ` Junio C Hamano @ 2016-06-20 23:21 ` Nikolaus Rath 2016-06-21 8:28 ` Michael J Gruber 2016-06-21 18:04 ` Nikolaus Rath 0 siblings, 2 replies; 9+ messages in thread From: Nikolaus Rath @ 2016-06-20 23:21 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: > Nikolaus Rath <Nikolaus@rath.org> 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? Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-20 23:21 ` Nikolaus Rath @ 2016-06-21 8:28 ` Michael J Gruber 2016-06-22 16:38 ` Nikolaus Rath 2016-06-21 18:04 ` Nikolaus Rath 1 sibling, 1 reply; 9+ messages in thread From: Michael J Gruber @ 2016-06-21 8:28 UTC (permalink / raw) To: Junio C Hamano, git, Nikolaus Rath Nikolaus Rath venit, vidit, dixit 21.06.2016 01:21: > On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: >> Nikolaus Rath <Nikolaus@rath.org> 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-21 8:28 ` Michael J Gruber @ 2016-06-22 16:38 ` Nikolaus Rath 0 siblings, 0 replies; 9+ messages in thread From: Nikolaus Rath @ 2016-06-22 16:38 UTC (permalink / raw) To: git On Jun 21 2016, Michael J Gruber <git@drmicha.warpmail.net> wrote: > Nikolaus Rath venit, vidit, dixit 21.06.2016 01:21: >> On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: >>> Nikolaus Rath <Nikolaus@rath.org> 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. This worked nicely too, thanks! Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-20 23:21 ` Nikolaus Rath 2016-06-21 8:28 ` Michael J Gruber @ 2016-06-21 18:04 ` Nikolaus Rath 2016-06-21 18:31 ` Junio C Hamano 1 sibling, 1 reply; 9+ messages in thread From: Nikolaus Rath @ 2016-06-21 18:04 UTC (permalink / raw) To: git On Jun 20 2016, Nikolaus Rath <Nikolaus@rath.org> wrote: > On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: >> Nikolaus Rath <Nikolaus@rath.org> 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? I meant to add: the repository I'm working with is at https://github.com/libfuse/libfuse/. Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-21 18:04 ` Nikolaus Rath @ 2016-06-21 18:31 ` Junio C Hamano 2016-06-22 16:38 ` Nikolaus Rath 0 siblings, 1 reply; 9+ messages in thread From: Junio C Hamano @ 2016-06-21 18:31 UTC (permalink / raw) To: git Nikolaus Rath <Nikolaus@rath.org> writes: > On Jun 20 2016, Nikolaus Rath <Nikolaus@rath.org> wrote: >> On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: >>> Nikolaus Rath <Nikolaus@rath.org> 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. Hmm, so the topology roughly would look like: A'--B'--D' 2fix / o---A---B---C---D---E---F master 3start And you want to find commits in 3start..master that do not have equivalent in 3start..2fix "git cherry --help" starts like this: NAME git-cherry - Find commits yet to be applied to upstream SYNOPSIS git cherry [-v] [<upstream> [<head> [<limit>]]] DESCRIPTION Determine whether there are commits in <head>..<upstream> that are equivalent to those in the range <limit>..<head>. Applying that to our picture, we want to find commits yet to be applied to 2fix, and do so by comparing the commits between 3start..master and 3start..2fix. I find that the first sentence of the description is fuzzy ("Determine whether" would imply that you would get "Yes/No" but what we want is "here are the commits that do not have counterpart in 2fix"), but we already know <upstream> corresponds to 2fix (i.e. we are finding ones yet to be applied to there, which can be inferred from the NAME line), so <head> must be 'master' That means that <limit> corresponds to 3start, and we will be comparing commits in two ranges: master..2fix (i e. <head>..<upstream>, which is the same thing as 3start..2fix) 3start..master (i.e. <limit>..<head>) So perhaps "git cherry -v 2fix master 3start"? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-21 18:31 ` Junio C Hamano @ 2016-06-22 16:38 ` Nikolaus Rath 2016-06-22 18:20 ` Junio C Hamano 0 siblings, 1 reply; 9+ messages in thread From: Nikolaus Rath @ 2016-06-22 16:38 UTC (permalink / raw) To: git On Jun 21 2016, Junio C Hamano <gitster@pobox.com> wrote: > Nikolaus Rath <Nikolaus@rath.org> writes: > >> On Jun 20 2016, Nikolaus Rath <Nikolaus@rath.org> wrote: >>> On Jun 20 2016, Junio C Hamano <gitster@pobox.com> wrote: >>>> Nikolaus Rath <Nikolaus@rath.org> 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. > > Hmm, so the topology roughly would look like: > > A'--B'--D' 2fix > / > o---A---B---C---D---E---F master > 3start > > And you want to find commits in 3start..master that do not have > equivalent in 3start..2fix > > "git cherry --help" starts like this: > > NAME > git-cherry - Find commits yet to be applied to upstream > > SYNOPSIS > git cherry [-v] [<upstream> [<head> [<limit>]]] > > DESCRIPTION > Determine whether there are commits in <head>..<upstream> > that are equivalent to those in the range <limit>..<head>. > > Applying that to our picture, we want to find commits yet to be > applied to 2fix, and do so by comparing the commits between > 3start..master and 3start..2fix. > > I find that the first sentence of the description is fuzzy > ("Determine whether" would imply that you would get "Yes/No" but > what we want is "here are the commits that do not have counterpart > in 2fix"), but we already know <upstream> corresponds to 2fix > (i.e. we are finding ones yet to be applied to there, which can be > inferred from the NAME line), so <head> must be 'master' That means > that <limit> corresponds to 3start, and we will be comparing commits > in two ranges: > > master..2fix (i e. <head>..<upstream>, which is the same thing as 3start..2fix) > 3start..master (i.e. <limit>..<head>) > > So perhaps "git cherry -v 2fix master 3start"? This works, thanks! I don't quite understand why though. I started by saying that I want to know which commits in master are have been cherry picked after 3start was branched to 2fix, so <limit>..<head> must be 3start..2fix, which only leaves "master" as <upstream>. What's wrong with that thought? Best, -Nikolaus -- GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F »Time flies like an arrow, fruit flies like a Banana.« ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: How to find commits unique to a branch 2016-06-22 16:38 ` Nikolaus Rath @ 2016-06-22 18:20 ` Junio C Hamano 0 siblings, 0 replies; 9+ messages in thread From: Junio C Hamano @ 2016-06-22 18:20 UTC (permalink / raw) To: git Nikolaus Rath <Nikolaus@rath.org> writes: > On Jun 21 2016, Junio C Hamano <gitster@pobox.com> wrote: >> >> I find that the first sentence of the description is fuzzy >> ("Determine whether" would imply that you would get "Yes/No" but >> what we want is "here are the commits that do not have counterpart >> in 2fix"),... > > This works, thanks! I don't quite understand why though. I started by > saying that I want to know which commits in master are have been cherry > picked after 3start was branched to 2fix, so <limit>..<head> must be > 3start..2fix, which only leaves "master" as <upstream>. What's wrong > with that thought? The only thing that is wrong in that is it does not match what happens, but that is not the fault of the "thought"; as I said, I think the description is fuzzy and has room for improvement to avoid being read in such a way that leads to a wrong conclusion. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-06-22 18:20 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-20 20:43 How to find commits unique to a branch Nikolaus Rath 2016-06-20 22:21 ` Junio C Hamano 2016-06-20 23:21 ` Nikolaus Rath 2016-06-21 8:28 ` Michael J Gruber 2016-06-22 16:38 ` Nikolaus Rath 2016-06-21 18:04 ` Nikolaus Rath 2016-06-21 18:31 ` Junio C Hamano 2016-06-22 16:38 ` Nikolaus Rath 2016-06-22 18:20 ` Junio C Hamano
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).