{"thread":{"id":"38497","subject":"git tag --no-merged?","startedAt":"2015-02-04T15:19:59Z","lastAt":"2015-02-05T09:09:23Z","messageCount":6,"participants":["Peter Krefting","Junio C Hamano","Johannes Sixt","Kyle J. McKay"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"255604","messageId":"alpine.DEB.2.00.1502041615110.30476@ds9.cixit.se","threadId":"38497","inReplyTo":null,"subject":"git tag --no-merged?","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2015-02-04T15:19:59Z","receivedAt":"2015-02-04T15:19:59Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Hi!\n\nUsing \"git branch --no-merged\" I can get a list of branches that I \nhave that I haven't merged into my current branch. \"git tag\" doesn't \nhave such an option, is there a way to achieve something similar \nlisting tags that point to commits that aren't in my history?\n\n\n\nBackground: In my $DAYJOB we have a couple of products that are built \nfrom a common source tree. Each of the products have their own \nmaintenance branches, and releases from these maintenance branches are \ntagged. I want to merge the changes from the maintenance branches to \nmaster (and possibly to other maintenance branches if there are \nchanges relevant to other products), but I only want to do this for \nour tagged released.\n\nUsing \"git branch --no-merged\" I can see which of the maintenance \nbranches have commits that haven't been merged yet, but I cannot tell \nwhether any of those have been tagged.\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"},{"id":"255608","messageId":"xmqq61bho6ub.fsf@gitster.dls.corp.google.com","threadId":"38497","inReplyTo":"alpine.DEB.2.00.1502041615110.30476@ds9.cixit.se","subject":"Re: git tag --no-merged?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-04T18:43:40Z","receivedAt":"2015-02-04T18:43:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Peter Krefting <peter@softwolves.pp.se> writes:\n\n> Using \"git branch --no-merged\" I can get a list of branches that I\n> have that I haven't merged into my current branch. \"git tag\" doesn't\n> have such an option, is there a way to achieve something similar\n> listing tags that point to commits that aren't in my history?\n\nUsing canned set of tools, I do not think there is anything less\ncomplex than doing something like:\n\n $ git log --oneline --decorate --branches --not --tags\n\nThe longer term goal that has been floated a few times here is to\nunify various logic that computes containment relationships in\n\"branch\", \"tags\", etc. to one place and perhaps expose that unified\nlogic to \"for-each-ref\", but that hasn't happened yet.\n"},{"id":"255609","messageId":"54D26B7C.7020300@kdbg.org","threadId":"38497","inReplyTo":"alpine.DEB.2.00.1502041615110.30476@ds9.cixit.se","subject":"Re: git tag --no-merged?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2015-02-04T18:57:00Z","receivedAt":"2015-02-04T18:57:00Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 04.02.2015 um 16:19 schrieb Peter Krefting:\n> Using \"git branch --no-merged\" I can get a list of branches that I have\n> that I haven't merged into my current branch.\n\nAssuming v2.0.0 is a tag, using \"git branch --no-merged v2.0.0\" you can\nsee which branches haven't been merged into v2.0.0.\n\n-- Hannes\n"},{"id":"255611","messageId":"xmqq1tm5nz9l.fsf@gitster.dls.corp.google.com","threadId":"38497","inReplyTo":"54D26B7C.7020300@kdbg.org","subject":"Re: git tag --no-merged?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-02-04T21:27:18Z","receivedAt":"2015-02-04T21:27:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> Am 04.02.2015 um 16:19 schrieb Peter Krefting:\n>> Using \"git branch --no-merged\" I can get a list of branches that I have\n>> that I haven't merged into my current branch.\n>\n> Assuming v2.0.0 is a tag, using \"git branch --no-merged v2.0.0\" you can\n> see which branches haven't been merged into v2.0.0.\n\nI think the request is a bit more involved than \"Which one is not\nyet in v2.0.0?\"\n\nThe question, as I now understand it after reading it again, \n\n    I want to merge the changes from the maintenance branches to\n    master (and possibly to other maintenance branches if there are\n    changes relevant to other products), but I only want to do this for\n    our tagged released.\n\nis \"which branches, whose tips are already tagged, are not yet in\n'master'?\"\n\nThe one I gave is not what was asked, either, as I misread the\nquestion.  It was an answer to \"which commits are not yet in any\ntagged version, show them together with the names of branches from\nwhich they are reached\".\n"},{"id":"255614","messageId":"6A0F0356-2AF1-487D-A20E-FB6051D9E689@gmail.com","threadId":"38497","inReplyTo":"alpine.DEB.2.00.1502041615110.30476@ds9.cixit.se","subject":"Re: git tag --no-merged?","fromName":"Kyle J. McKay","fromEmail":"mackyle@gmail.com","sentAt":"2015-02-05T00:22:54Z","receivedAt":"2015-02-05T00:22:54Z","isPatch":false,"sender":{"key":"mackyle@gmail.com","avatar":"https://avatars.githubusercontent.com/u/813346?v=4"},"body":"On Feb 4, 2015, at 07:19, Peter Krefting wrote:\n> Using \"git branch --no-merged\" I can get a list of branches that I  \n> have that I haven't merged into my current branch. \"git tag\" doesn't  \n> have such an option, is there a way to achieve something similar  \n> listing tags that point to commits that aren't in my history?\n\nI think something like this might do what you want:\n\ngit for-each-ref --format='%(refname)' refs/tags | \\\nwhile read t; do\n   if ! git merge-base --is-ancestor $t HEAD; then\n     echo ${t#refs/tags/}\n   fi\ndone\n\nIf you run that on the Git repository (assuming you've checked out  \nmaster), after a while (there are a lot of tags to check) it spits out  \nv1.4.4.5 (along with some complaints about *-gpg-pub tags that refer  \nto blobs).\n\nAnd sure enough, `git log v1.4.4.5 ^master` shows 5 commits not  \ncontained in master so I think it does what you want.  You'll want to  \nrestrict the for-each-ref output further, if possible, to make it  \nquicker.\n\n-Kyle\n"},{"id":"255621","messageId":"alpine.DEB.2.00.1502051001090.10655@ds9.cixit.se","threadId":"38497","inReplyTo":"6A0F0356-2AF1-487D-A20E-FB6051D9E689@gmail.com","subject":"Re: git tag --no-merged?","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2015-02-05T09:09:23Z","receivedAt":"2015-02-05T09:09:23Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Kyle J. McKay:\n\n> I think something like this might do what you want:\n>\n> git for-each-ref --format='%(refname)' refs/tags | \\\n> while read t; do\n> if ! git merge-base --is-ancestor $t HEAD; then\n>   echo ${t#refs/tags/}\n> fi\n> done\n\nThat works like a charm, thank you!\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"}]}