Skip to content

Tags

Tag operations are available via repo.tags.

let tags = try repo.tags.list()
for tag in tags {
print(tag.name)
}

A lightweight tag is just a named pointer to a commit — no metadata.

let commit = try repo.log(limit: 1).first!
try repo.tags.create(named: "v1.0.0", at: commit)

An annotated tag stores a message, tagger identity, and timestamp.

let tagger = Signature(name: "Alice", email: "alice@example.com")
let commit = try repo.log(limit: 1).first!
try repo.tags.create(
named: "v1.0.0",
at: commit,
message: "Initial public release",
tagger: tagger
)
try repo.tags.delete(named: "v1.0.0")
public struct Tag: Sendable, Identifiable {
public let name: String
public let oid: OID
public let message: String? // nil for lightweight tags
public let tagger: Signature?
}