File: README.md

package info (click to toggle)
golang-github-muesli-gitcha 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 124 kB
  • sloc: makefile: 3
file content (36 lines) | stat: -rw-r--r-- 1,353 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# gitcha

[![Latest Release](https://img.shields.io/github/release/muesli/gitcha.svg)](https://github.com/muesli/gitcha/releases)
[![Build Status](https://github.com/muesli/gitcha/workflows/build/badge.svg)](https://github.com/muesli/gitcha/actions)
[![Coverage Status](https://coveralls.io/repos/github/muesli/gitcha/badge.svg?branch=master)](https://coveralls.io/github/muesli/gitcha?branch=master)
[![Go ReportCard](https://goreportcard.com/badge/muesli/gitcha)](https://goreportcard.com/report/muesli/gitcha)
[![GoDoc](https://godoc.org/github.com/golang/gddo?status.svg)](https://pkg.go.dev/github.com/muesli/gitcha)

Go helpers to work with git repositories

## Examples

```go
import "github.com/muesli/gitcha"

// returns the directory of the git repository path is a member of:
repo, err := gitcha.GitRepoForPath(path)

// finds files from list in path. It respects all .gitignores it finds while
// traversing paths:
ch, err := gitcha.FindFiles(path, []string{"*.md"})
for v := range ch {
    fmt.Println(v.Path)
}

// finds files, excluding any matches in a given set of ignore patterns:
ch, err := gitcha.FindFilesExcept(path, []string{"*.md"}, []string{".*"})
...

// if you are only interested in the first match:
result, err := gitcha.FindFirstFile(path, []string{"*.md"})
...

// just for convenience:
ok := gitcha.IsPathInGit(path)
```