Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/troian/git-templates
https://github.com/troian/git-templates
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/troian/git-templates
- Owner: troian
- License: mit
- Created: 2021-10-18T13:26:13.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-18T14:30:06.000Z (9 months ago)
- Last Synced: 2024-11-04T12:25:16.155Z (2 months ago)
- Language: Shell
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Git hooks templates
This repo automates installation and usage of various git hooks during `git init` or `git clone`
## How to use it
1. Clone this repo in to place of your choice. We will be using `~/.config/git-templates` in this example
```shell
git clone https://github.com/troian/git-templates ~/.config/git-templates
```2. Lets git know where to search for templates. In ~/.gitconfig add/edit `init` section
```git
[init]
templatedir = ~/.config/git-templates # <--- this is what we add
```Now, everytime repo is created or cloned git will install following files into repo's `.git` dir
```
.git/
configure.sh
update.sh
```1. `configure.sh` - configures what hooks to use. simply call it `.git/configure.sh` and follow prompts to install hooks of your choice
2. whenever hooks are updated in the upstream, call `.git/update.sh` to update them## How to add new hooks to this repo
1. Create directory inside `hooks`. give it sensible name
2. Create hook(s) files and make sure they are executable. Allowed hook types are: `commit-msg` `pre-commit` `post-commit` `pre-push` `post-push`