Git development
 help / color / mirror / Atom feed
* git tag --no-merged?
@ 2015-02-04 15:19 Peter Krefting
  2015-02-04 18:43 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Krefting @ 2015-02-04 15:19 UTC (permalink / raw)
  To: Git Mailing List

Hi!

Using "git branch --no-merged" I can get a list of branches that I 
have that I haven't merged into my current branch. "git tag" doesn't 
have such an option, is there a way to achieve something similar 
listing tags that point to commits that aren't in my history?



Background: In my $DAYJOB we have a couple of products that are built 
from a common source tree. Each of the products have their own 
maintenance branches, and releases from these maintenance branches are 
tagged. I want to merge the changes from the maintenance branches to 
master (and possibly to other maintenance branches if there are 
changes relevant to other products), but I only want to do this for 
our tagged released.

Using "git branch --no-merged" I can see which of the maintenance 
branches have commits that haven't been merged yet, but I cannot tell 
whether any of those have been tagged.

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git tag --no-merged?
  2015-02-04 15:19 git tag --no-merged? Peter Krefting
@ 2015-02-04 18:43 ` Junio C Hamano
  2015-02-04 18:57 ` Johannes Sixt
  2015-02-05  0:22 ` Kyle J. McKay
  2 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2015-02-04 18:43 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List

Peter Krefting <peter@softwolves.pp.se> writes:

> Using "git branch --no-merged" I can get a list of branches that I
> have that I haven't merged into my current branch. "git tag" doesn't
> have such an option, is there a way to achieve something similar
> listing tags that point to commits that aren't in my history?

Using canned set of tools, I do not think there is anything less
complex than doing something like:

 $ git log --oneline --decorate --branches --not --tags

The longer term goal that has been floated a few times here is to
unify various logic that computes containment relationships in
"branch", "tags", etc. to one place and perhaps expose that unified
logic to "for-each-ref", but that hasn't happened yet.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git tag --no-merged?
  2015-02-04 15:19 git tag --no-merged? Peter Krefting
  2015-02-04 18:43 ` Junio C Hamano
@ 2015-02-04 18:57 ` Johannes Sixt
  2015-02-04 21:27   ` Junio C Hamano
  2015-02-05  0:22 ` Kyle J. McKay
  2 siblings, 1 reply; 6+ messages in thread
From: Johannes Sixt @ 2015-02-04 18:57 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git Mailing List

Am 04.02.2015 um 16:19 schrieb Peter Krefting:
> Using "git branch --no-merged" I can get a list of branches that I have
> that I haven't merged into my current branch.

Assuming v2.0.0 is a tag, using "git branch --no-merged v2.0.0" you can
see which branches haven't been merged into v2.0.0.

-- Hannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git tag --no-merged?
  2015-02-04 18:57 ` Johannes Sixt
@ 2015-02-04 21:27   ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2015-02-04 21:27 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Peter Krefting, Git Mailing List

Johannes Sixt <j6t@kdbg.org> writes:

> Am 04.02.2015 um 16:19 schrieb Peter Krefting:
>> Using "git branch --no-merged" I can get a list of branches that I have
>> that I haven't merged into my current branch.
>
> Assuming v2.0.0 is a tag, using "git branch --no-merged v2.0.0" you can
> see which branches haven't been merged into v2.0.0.

I think the request is a bit more involved than "Which one is not
yet in v2.0.0?"

The question, as I now understand it after reading it again, 

    I want to merge the changes from the maintenance branches to
    master (and possibly to other maintenance branches if there are
    changes relevant to other products), but I only want to do this for
    our tagged released.

is "which branches, whose tips are already tagged, are not yet in
'master'?"

The one I gave is not what was asked, either, as I misread the
question.  It was an answer to "which commits are not yet in any
tagged version, show them together with the names of branches from
which they are reached".

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git tag --no-merged?
  2015-02-04 15:19 git tag --no-merged? Peter Krefting
  2015-02-04 18:43 ` Junio C Hamano
  2015-02-04 18:57 ` Johannes Sixt
@ 2015-02-05  0:22 ` Kyle J. McKay
  2015-02-05  9:09   ` Peter Krefting
  2 siblings, 1 reply; 6+ messages in thread
From: Kyle J. McKay @ 2015-02-05  0:22 UTC (permalink / raw)
  To: Peter Krefting; +Cc: Git mailing list, Junio C Hamano, Johannes Sixt

On Feb 4, 2015, at 07:19, Peter Krefting wrote:
> Using "git branch --no-merged" I can get a list of branches that I  
> have that I haven't merged into my current branch. "git tag" doesn't  
> have such an option, is there a way to achieve something similar  
> listing tags that point to commits that aren't in my history?

I think something like this might do what you want:

git for-each-ref --format='%(refname)' refs/tags | \
while read t; do
   if ! git merge-base --is-ancestor $t HEAD; then
     echo ${t#refs/tags/}
   fi
done

If you run that on the Git repository (assuming you've checked out  
master), after a while (there are a lot of tags to check) it spits out  
v1.4.4.5 (along with some complaints about *-gpg-pub tags that refer  
to blobs).

And sure enough, `git log v1.4.4.5 ^master` shows 5 commits not  
contained in master so I think it does what you want.  You'll want to  
restrict the for-each-ref output further, if possible, to make it  
quicker.

-Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git tag --no-merged?
  2015-02-05  0:22 ` Kyle J. McKay
@ 2015-02-05  9:09   ` Peter Krefting
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Krefting @ 2015-02-05  9:09 UTC (permalink / raw)
  To: Kyle J. McKay; +Cc: Git mailing list

Kyle J. McKay:

> I think something like this might do what you want:
>
> git for-each-ref --format='%(refname)' refs/tags | \
> while read t; do
> if ! git merge-base --is-ancestor $t HEAD; then
>   echo ${t#refs/tags/}
> fi
> done

That works like a charm, thank you!

-- 
\\// Peter - http://www.softwolves.pp.se/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-02-05  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 15:19 git tag --no-merged? Peter Krefting
2015-02-04 18:43 ` Junio C Hamano
2015-02-04 18:57 ` Johannes Sixt
2015-02-04 21:27   ` Junio C Hamano
2015-02-05  0:22 ` Kyle J. McKay
2015-02-05  9:09   ` Peter Krefting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox