Skip to content

Get annotated tags #1937

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

You must be logged in to vote

Maybe this helps: https://chatgpt.com/share/b1010a46-8079-414e-89ab-da43b2af90b9 .

Here is a copy of the code it produced:

import git

# Path to your repository
repo_path = '/path/to/your/repo'

# Initialize the Repo object
repo = git.Repo(repo_path)

# Get all tags
all_tags = repo.tags

# Filter annotated tags
annotated_tags = [tag for tag in all_tags if tag.tag is not None]

# Print the annotated tags
for tag in annotated_tags:
    print(f"Annotated Tag: {tag.name}")
    print(f"Tag Message: {tag.tag.message}")
    print(f"Tag Object: {tag.tag.object}")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AlesyaSeliazniova30032012
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
Converted from issue

This discussion was converted from issue #1936 on July 04, 2024 17:27.