https://github.com/muesli/gitcha
Go helpers to work with git repositories
https://github.com/muesli/gitcha
hacktoberfest
Last synced: 6 months ago
JSON representation
Go helpers to work with git repositories
- Host: GitHub
- URL: https://github.com/muesli/gitcha
- Owner: muesli
- License: mit
- Created: 2020-07-13T12:42:53.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-09-05T07:49:21.000Z (almost 2 years ago)
- Last Synced: 2024-12-10T14:49:24.261Z (6 months ago)
- Topics: hacktoberfest
- Language: Go
- Size: 40 KB
- Stars: 35
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# gitcha
[](https://github.com/muesli/gitcha/releases)
[](https://github.com/muesli/gitcha/actions)
[](https://coveralls.io/github/muesli/gitcha?branch=master)
[](https://goreportcard.com/report/muesli/gitcha)
[](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)
```