https://github.com/rvflash/git-template
Easy global hooks with Git template directory.
https://github.com/rvflash/git-template
git golang hooks
Last synced: 2 months ago
JSON representation
Easy global hooks with Git template directory.
- Host: GitHub
- URL: https://github.com/rvflash/git-template
- Owner: rvflash
- Created: 2018-07-29T11:35:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T23:08:32.000Z (over 7 years ago)
- Last Synced: 2025-03-23T09:35:14.417Z (about 1 year ago)
- Topics: git, golang, hooks
- Language: Shell
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Git template
With the option `--template` on the `git init` command, you can specify a directory from which templates will be used.
To do it, whenever you initialize a new repository, you can add a section in your `~/.gitconfig` file.
More information in the documentation of [Git template directory](https://git-scm.com/docs/git-init#_template_directory).
This project provides a directory to use as `git` template directory to simplify the workflow.
Usefull to create global hooks!
> For now, only Golang code has a template directory with a `pre-commit` hook inside.
## Installation
```bash
$ git clone https://github.com/rvflash/git-template.git ~/.git-template
```
## Quick start
To use it for all your future repositories, edit the `~/.gitconfig` and add this section:
```bash
[init]
templatedir = ~/.git-template/go
```
Or you can specify to use it on the fly when initializing a repository:
```bash
$ git init --template="~/.git-template/go"
```
### Repository with Go code
Exposes a pre-commit hook that launches all the tests, `golint`, `goimports`, `gofmt` and `govet`.
If one of them failed, the commit is aborded.
In order to use more linters without degrading performance, if available, `golangci-lint` is used.