Re: git tag --no-merged?

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

 



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

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