Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Equivalent to git tag --contains <commit> #1269

Answered by Byron
bytefluxio asked this question in Q&A
Discussion options

What would be the gitpython equivalent of git tag --contains <commit>

I need to ascertain all tags that point to descendants of a commit. The git command is incredibly fast, but doing the following just isn't effective:

tags = []
 for tag in self.repo.tags:
 if self.repo.is_ancestor(git_hash, tag.commit):
 tags.append(tag)
You must be logged in to vote

I would go with self.repo.git.tag(contains=commit).

Replies: 1 comment

Comment options

I would go with self.repo.git.tag(contains=commit).

You must be logged in to vote
0 replies
Answer selected by Byron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /