Skip to content

Repository files navigation

gitrefs

Provides a simple way to list references from a remote git repository over HTTP, without needing a full git client or a checkout of the remote repository.

Example:

package main
import (
"fmt""github.com/csmith/gitrefs"
)
funcmain() {
refs, err:=gitrefs.Fetch("https://github.com/csmith/gitrefs")
iferr!=nil {
panic(err)
}
forr:=rangerefs {
fmt.Printf("Ref %s at commit %s\n", r, refs[r])
}
}

A utility method to retrieve only the latest semver tag is included:

package main
import (
"fmt""github.com/csmith/gitrefs"
)
funcmain() {
tag, hash, err:=gitrefs.LatestTag("https://github.com/csmith/gitrefs")
iferr!=nil {
panic(err)
}
fmt.Printf("Latest tag is %s at commit %s\n", tag, hash)
}

Protocol docs:

About

List references from repote git repos in go

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages