https://github.com/csmith/gitrefs
List references from repote git repos in go
https://github.com/csmith/gitrefs
Last synced: 5 months ago
JSON representation
List references from repote git repos in go
- Host: GitHub
- URL: https://github.com/csmith/gitrefs
- Owner: csmith
- License: mit
- Created: 2021-09-24T21:20:01.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-11-20T13:42:20.000Z (7 months ago)
- Last Synced: 2025-11-20T15:26:18.109Z (7 months ago)
- Language: Go
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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:
```go
package main
import (
"fmt"
"github.com/csmith/gitrefs"
)
func main() {
refs, err := gitrefs.Fetch("https://github.com/csmith/gitrefs")
if err != nil {
panic(err)
}
for r := range refs {
fmt.Printf("Ref %s at commit %s\n", r, refs[r])
}
}
```
A utility method to retrieve only the latest semver tag is included:
```go
package main
import (
"fmt"
"github.com/csmith/gitrefs"
)
func main() {
tag, hash, err := gitrefs.LatestTag("https://github.com/csmith/gitrefs")
if err != nil {
panic(err)
}
fmt.Printf("Latest tag is %s at commit %s\n", tag, hash)
}
```
Protocol docs:
- https://www.git-scm.com/docs/http-protocol
- https://git-scm.com/docs/pack-protocol